mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 06:44:32 +00:00
feat: add live preview method setting for prompt execution (#7385)
## Summary Add frontend setting to override live preview method per prompt execution. ## Changes - **What**: New setting `Comfy.Execution.PreviewMethod` allows users to override preview method (default/none/auto/latent2rgb/taesd) from frontend. Applied to Queue Prompt, Queue Front, Run Selected Nodes, and Auto Queue. - **Dependencies**: Requires backend support from comfyanonymous/ComfyUI#11261 ## Review Focus - `'default'` option does not send `preview_method` to backend (uses server CLI setting) - Legacy UI intentionally not modified (deprecated, maintains backward compatibility) - `versionAdded: '1.35.3'` assigned tentatively; adjust as needed for actual release version ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7385-feat-add-live-preview-method-setting-for-prompt-execution-2c66d73d365081759c9cebaec29f451c) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -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'
|
||||
@@ -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
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user