mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
[backport core/1.34] feat: add live preview method setting for prompt execution (#7521)
## Summary Backport of #7385 to core/1.34. Add frontend setting to override live preview method per prompt execution. - **What**: New setting `Comfy.Execution.PreviewMethod` allows users to override preview method (default/none/auto/latent2rgb/taesd) from frontend. ## Conflict Resolution - `src/schemas/apiSchema.ts`: Kept both `Comfy.Queue.ImageFit` (target branch) and `Comfy.Execution.PreviewMethod` (PR addition) Co-authored-by: Dr.Lt.Data <128333288+ltdrdata@users.noreply.github.com>
This commit is contained in:
@@ -53,6 +53,17 @@
|
|||||||
"Comfy_EnableWorkflowViewRestore": {
|
"Comfy_EnableWorkflowViewRestore": {
|
||||||
"name": "Save and restore canvas position and zoom level in workflows"
|
"name": "Save and restore canvas position and zoom level in workflows"
|
||||||
},
|
},
|
||||||
|
"Comfy_Execution_PreviewMethod": {
|
||||||
|
"name": "Live preview method",
|
||||||
|
"tooltip": "Live preview method during image generation. \"default\" uses the server CLI setting.",
|
||||||
|
"options": {
|
||||||
|
"default": "default",
|
||||||
|
"none": "none",
|
||||||
|
"auto": "auto",
|
||||||
|
"latent2rgb": "latent2rgb",
|
||||||
|
"taesd": "taesd"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Comfy_FloatRoundingPrecision": {
|
"Comfy_FloatRoundingPrecision": {
|
||||||
"name": "Float widget rounding decimal places [0 = auto].",
|
"name": "Float widget rounding decimal places [0 = auto].",
|
||||||
"tooltip": "(requires page reload)"
|
"tooltip": "(requires page reload)"
|
||||||
|
|||||||
@@ -813,6 +813,17 @@ export const CORE_SETTINGS: SettingParams[] = [
|
|||||||
defaultValue: 64,
|
defaultValue: 64,
|
||||||
versionAdded: '1.4.12'
|
versionAdded: '1.4.12'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'Comfy.Execution.PreviewMethod',
|
||||||
|
category: ['Comfy', 'Execution', 'PreviewMethod'],
|
||||||
|
name: 'Live preview method',
|
||||||
|
tooltip:
|
||||||
|
'Live preview method during image generation. "default" uses the server CLI setting.',
|
||||||
|
type: 'combo',
|
||||||
|
options: ['default', 'none', 'auto', 'latent2rgb', 'taesd'],
|
||||||
|
defaultValue: 'default',
|
||||||
|
versionAdded: '1.36.0'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'LiteGraph.Canvas.MaximumFps',
|
id: 'LiteGraph.Canvas.MaximumFps',
|
||||||
name: 'Maximum FPS',
|
name: 'Maximum FPS',
|
||||||
|
|||||||
@@ -369,6 +369,15 @@ const zNodeBadgeMode = z.enum(
|
|||||||
Object.values(NodeBadgeMode) as [string, ...string[]]
|
Object.values(NodeBadgeMode) as [string, ...string[]]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const zPreviewMethod = z.enum([
|
||||||
|
'default',
|
||||||
|
'none',
|
||||||
|
'auto',
|
||||||
|
'latent2rgb',
|
||||||
|
'taesd'
|
||||||
|
])
|
||||||
|
export type PreviewMethod = z.infer<typeof zPreviewMethod>
|
||||||
|
|
||||||
const zSettings = z.object({
|
const zSettings = z.object({
|
||||||
'Comfy.ColorPalette': z.string(),
|
'Comfy.ColorPalette': z.string(),
|
||||||
'Comfy.CustomColorPalettes': colorPalettesSchema,
|
'Comfy.CustomColorPalettes': colorPalettesSchema,
|
||||||
@@ -431,6 +440,7 @@ const zSettings = z.object({
|
|||||||
'Comfy.Validation.Workflows': z.boolean(),
|
'Comfy.Validation.Workflows': z.boolean(),
|
||||||
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
|
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
|
||||||
'Comfy.Queue.ImageFit': z.enum(['contain', 'cover']),
|
'Comfy.Queue.ImageFit': z.enum(['contain', 'cover']),
|
||||||
|
'Comfy.Execution.PreviewMethod': zPreviewMethod,
|
||||||
'Comfy.Workflow.WorkflowTabsPosition': z.enum(['Sidebar', 'Topbar']),
|
'Comfy.Workflow.WorkflowTabsPosition': z.enum(['Sidebar', 'Topbar']),
|
||||||
'Comfy.Node.DoubleClickTitleToEdit': z.boolean(),
|
'Comfy.Node.DoubleClickTitleToEdit': z.boolean(),
|
||||||
'Comfy.WidgetControlMode': z.enum(['before', 'after']),
|
'Comfy.WidgetControlMode': z.enum(['before', 'after']),
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ import type {
|
|||||||
StatusWsMessageStatus,
|
StatusWsMessageStatus,
|
||||||
SystemStats,
|
SystemStats,
|
||||||
User,
|
User,
|
||||||
UserDataFullInfo
|
UserDataFullInfo,
|
||||||
|
PreviewMethod
|
||||||
} from '@/schemas/apiSchema'
|
} from '@/schemas/apiSchema'
|
||||||
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
|
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
|
||||||
import type { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
|
import type { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
|
||||||
@@ -88,6 +89,11 @@ interface QueuePromptRequestBody {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
api_key_comfy_org?: string
|
api_key_comfy_org?: string
|
||||||
|
/**
|
||||||
|
* Override the preview method for this prompt execution.
|
||||||
|
* 'default' uses the server's CLI setting.
|
||||||
|
*/
|
||||||
|
preview_method?: PreviewMethod
|
||||||
}
|
}
|
||||||
front?: boolean
|
front?: boolean
|
||||||
number?: number
|
number?: number
|
||||||
@@ -103,6 +109,11 @@ interface QueuePromptOptions {
|
|||||||
* Format: Colon-separated path of node IDs (e.g., "123:456:789")
|
* Format: Colon-separated path of node IDs (e.g., "123:456:789")
|
||||||
*/
|
*/
|
||||||
partialExecutionTargets?: NodeExecutionId[]
|
partialExecutionTargets?: NodeExecutionId[]
|
||||||
|
/**
|
||||||
|
* Override the preview method for this prompt execution.
|
||||||
|
* 'default' uses the server's CLI setting and is not sent to backend.
|
||||||
|
*/
|
||||||
|
previewMethod?: PreviewMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dictionary of Frontend-generated API calls */
|
/** Dictionary of Frontend-generated API calls */
|
||||||
@@ -772,7 +783,11 @@ export class ComfyApi extends EventTarget {
|
|||||||
extra_data: {
|
extra_data: {
|
||||||
auth_token_comfy_org: this.authToken,
|
auth_token_comfy_org: this.authToken,
|
||||||
api_key_comfy_org: this.apiKey,
|
api_key_comfy_org: this.apiKey,
|
||||||
extra_pnginfo: { workflow }
|
extra_pnginfo: { workflow },
|
||||||
|
...(options?.previewMethod &&
|
||||||
|
options.previewMethod !== 'default' && {
|
||||||
|
preview_method: options.previewMethod
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1344,6 +1344,9 @@ export class ComfyApp {
|
|||||||
try {
|
try {
|
||||||
while (this.queueItems.length) {
|
while (this.queueItems.length) {
|
||||||
const { number, batchCount, queueNodeIds } = this.queueItems.pop()!
|
const { number, batchCount, queueNodeIds } = this.queueItems.pop()!
|
||||||
|
const previewMethod = useSettingStore().get(
|
||||||
|
'Comfy.Execution.PreviewMethod'
|
||||||
|
)
|
||||||
|
|
||||||
for (let i = 0; i < batchCount; i++) {
|
for (let i = 0; i < batchCount; i++) {
|
||||||
// Allow widgets to run callbacks before a prompt has been queued
|
// Allow widgets to run callbacks before a prompt has been queued
|
||||||
@@ -1358,7 +1361,8 @@ export class ComfyApp {
|
|||||||
api.authToken = comfyOrgAuthToken
|
api.authToken = comfyOrgAuthToken
|
||||||
api.apiKey = comfyOrgApiKey ?? undefined
|
api.apiKey = comfyOrgApiKey ?? undefined
|
||||||
const res = await api.queuePrompt(number, p, {
|
const res = await api.queuePrompt(number, p, {
|
||||||
partialExecutionTargets: queueNodeIds
|
partialExecutionTargets: queueNodeIds,
|
||||||
|
previewMethod
|
||||||
})
|
})
|
||||||
delete api.authToken
|
delete api.authToken
|
||||||
delete api.apiKey
|
delete api.apiKey
|
||||||
|
|||||||
Reference in New Issue
Block a user