mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
Implement workflow progress panel (#6092)
Adds a workflow progress panel component underneath the `actionbar-container`. I suggest starting a review at the extraneous changes that were needed. Including but not limited to: - `get createTime()` in queueStore - `promptIdToWorkflowId`, `initializingPromptIds`, and `nodeProgressStatesByPrompt` in executionStore - `create_time` handling in v2ToV1Adapter - `pointer-events-auto` on ComfyActionbar.vue The rest of the changes should be contained under `QueueProgressOverlay.vue`, and has less of a blast radius in case something goes wrong. --------- Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Jin Yi <jin12cc@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> Co-authored-by: christian-byrne <72887196+christian-byrne@users.noreply.github.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import type {
|
||||
HistoryTaskItem,
|
||||
LogsRawResponse,
|
||||
LogsWsMessage,
|
||||
NotificationWsMessage,
|
||||
PendingTaskItem,
|
||||
ProgressStateWsMessage,
|
||||
ProgressTextWsMessage,
|
||||
@@ -119,6 +120,7 @@ interface BackendApiCalls {
|
||||
executing: ExecutingWsMessage
|
||||
executed: ExecutedWsMessage
|
||||
status: StatusWsMessage
|
||||
notification: NotificationWsMessage
|
||||
execution_start: ExecutionStartWsMessage
|
||||
execution_success: ExecutionSuccessWsMessage
|
||||
execution_error: ExecutionErrorWsMessage
|
||||
@@ -649,6 +651,7 @@ export class ComfyApi extends EventTarget {
|
||||
case 'promptQueued':
|
||||
case 'logs':
|
||||
case 'b_preview':
|
||||
case 'notification':
|
||||
this.dispatchCustomEvent(msg.type, msg.data)
|
||||
break
|
||||
case 'feature_flags':
|
||||
@@ -873,17 +876,43 @@ export class ComfyApi extends EventTarget {
|
||||
try {
|
||||
const res = await this.fetchApi('/queue')
|
||||
const data = await res.json()
|
||||
// Normalize queue tuple shape across backends:
|
||||
// - Backend (V1): [idx, prompt_id, inputs, extra_data(object), outputs_to_execute(array)]
|
||||
// - Cloud: [idx, prompt_id, inputs, outputs_to_execute(array), metadata(object{create_time})]
|
||||
const normalizeQueuePrompt = (prompt: any): any => {
|
||||
if (!Array.isArray(prompt)) return prompt
|
||||
// Ensure 5-tuple
|
||||
const p = prompt.slice(0, 5)
|
||||
const fourth = p[3]
|
||||
const fifth = p[4]
|
||||
// Cloud shape: 4th is array, 5th is metadata object
|
||||
if (
|
||||
Array.isArray(fourth) &&
|
||||
fifth &&
|
||||
typeof fifth === 'object' &&
|
||||
!Array.isArray(fifth)
|
||||
) {
|
||||
const meta: any = fifth
|
||||
const extraData = { ...meta }
|
||||
return [p[0], p[1], p[2], extraData, fourth]
|
||||
}
|
||||
// V1 shape already: return as-is
|
||||
return p
|
||||
}
|
||||
return {
|
||||
// Running action uses a different endpoint for cancelling
|
||||
Running: data.queue_running.map((prompt: Record<number, any>) => ({
|
||||
taskType: 'Running',
|
||||
prompt,
|
||||
// prompt[1] is the prompt id
|
||||
remove: { name: 'Cancel', cb: () => api.interrupt(prompt[1]) }
|
||||
})),
|
||||
Pending: data.queue_pending.map((prompt: Record<number, any>) => ({
|
||||
Running: data.queue_running.map((prompt: any) => {
|
||||
const np = normalizeQueuePrompt(prompt)
|
||||
return {
|
||||
taskType: 'Running',
|
||||
prompt: np,
|
||||
// prompt[1] is the prompt id
|
||||
remove: { name: 'Cancel', cb: () => api.interrupt(np[1]) }
|
||||
}
|
||||
}),
|
||||
Pending: data.queue_pending.map((prompt: any) => ({
|
||||
taskType: 'Pending',
|
||||
prompt
|
||||
prompt: normalizeQueuePrompt(prompt)
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user