Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@
"Comfy_EnableWorkflowViewRestore": {
"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": {
"name": "Float widget rounding decimal places [0 = auto].",
"tooltip": "(requires page reload)"
Expand Down
11 changes: 11 additions & 0 deletions src/platform/settings/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,17 @@ export const CORE_SETTINGS: SettingParams[] = [
defaultValue: 64,
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',
name: 'Maximum FPS',
Expand Down
10 changes: 10 additions & 0 deletions src/schemas/apiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ const zNodeBadgeMode = z.enum(
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({
'Comfy.ColorPalette': z.string(),
'Comfy.CustomColorPalettes': colorPalettesSchema,
Expand Down Expand Up @@ -433,6 +442,7 @@ const zSettings = z.object({
'Comfy.TreeExplorer.ItemPadding': z.number(),
'Comfy.Validation.Workflows': z.boolean(),
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
'Comfy.Execution.PreviewMethod': zPreviewMethod,
'Comfy.Workflow.WorkflowTabsPosition': z.enum(['Sidebar', 'Topbar']),
'Comfy.Node.DoubleClickTitleToEdit': z.boolean(),
'Comfy.WidgetControlMode': z.enum(['before', 'after']),
Expand Down
19 changes: 17 additions & 2 deletions src/scripts/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import type {
StatusWsMessageStatus,
SystemStats,
User,
UserDataFullInfo
UserDataFullInfo,
PreviewMethod
} from '@/schemas/apiSchema'
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import type { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
Expand Down Expand Up @@ -89,6 +90,11 @@ interface QueuePromptRequestBody {
* ```
*/
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
number?: number
Expand All @@ -104,6 +110,11 @@ interface QueuePromptOptions {
* Format: Colon-separated path of node IDs (e.g., "123:456:789")
*/
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 */
Expand Down Expand Up @@ -773,7 +784,11 @@ export class ComfyApi extends EventTarget {
extra_data: {
auth_token_comfy_org: this.authToken,
api_key_comfy_org: this.apiKey,
extra_pnginfo: { workflow }
extra_pnginfo: { workflow },
...(options?.previewMethod &&
options.previewMethod !== 'default' && {
preview_method: options.previewMethod
})
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,9 @@ export class ComfyApp {
try {
while (this.queueItems.length) {
const { number, batchCount, queueNodeIds } = this.queueItems.pop()!
const previewMethod = useSettingStore().get(
'Comfy.Execution.PreviewMethod'
)

for (let i = 0; i < batchCount; i++) {
// Allow widgets to run callbacks before a prompt has been queued
Expand All @@ -1358,7 +1361,8 @@ export class ComfyApp {
api.authToken = comfyOrgAuthToken
api.apiKey = comfyOrgApiKey ?? undefined
const res = await api.queuePrompt(number, p, {
partialExecutionTargets: queueNodeIds
partialExecutionTargets: queueNodeIds,
previewMethod
})
delete api.authToken
delete api.apiKey
Expand Down
Loading