mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
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>
84 lines
2.1 KiB
TypeScript
84 lines
2.1 KiB
TypeScript
import { computed } from 'vue'
|
|
import type { ComputedRef } from 'vue'
|
|
|
|
import type { ExecutionErrorWsMessage } from '@/schemas/apiSchema'
|
|
import type { TaskItemImpl } from '@/stores/queueStore'
|
|
|
|
type CopyHandler = (value: string) => void | Promise<void>
|
|
|
|
export type JobErrorDialogService = {
|
|
showExecutionErrorDialog: (error: ExecutionErrorWsMessage) => void
|
|
showErrorDialog: (
|
|
error: Error,
|
|
options?: {
|
|
reportType?: string
|
|
[key: string]: unknown
|
|
}
|
|
) => void
|
|
}
|
|
|
|
type JobExecutionError = {
|
|
detail?: ExecutionErrorWsMessage
|
|
message: string
|
|
}
|
|
|
|
export const extractExecutionError = (
|
|
task: TaskItemImpl | null
|
|
): JobExecutionError | null => {
|
|
const status = (task as TaskItemImpl | null)?.status
|
|
const messages = (status as { messages?: unknown[] } | undefined)?.messages
|
|
if (!Array.isArray(messages) || !messages.length) return null
|
|
const record = messages.find((entry: unknown) => {
|
|
return Array.isArray(entry) && entry[0] === 'execution_error'
|
|
}) as [string, ExecutionErrorWsMessage?] | undefined
|
|
if (!record) return null
|
|
const detail = record[1]
|
|
const message = String(detail?.exception_message ?? '')
|
|
return {
|
|
detail,
|
|
message
|
|
}
|
|
}
|
|
|
|
type UseJobErrorReportingOptions = {
|
|
taskForJob: ComputedRef<TaskItemImpl | null>
|
|
copyToClipboard: CopyHandler
|
|
dialog: JobErrorDialogService
|
|
}
|
|
|
|
export const useJobErrorReporting = ({
|
|
taskForJob,
|
|
copyToClipboard,
|
|
dialog
|
|
}: UseJobErrorReportingOptions) => {
|
|
const errorMessageValue = computed(() => {
|
|
const error = extractExecutionError(taskForJob.value)
|
|
return error?.message ?? ''
|
|
})
|
|
|
|
const copyErrorMessage = () => {
|
|
if (errorMessageValue.value) {
|
|
void copyToClipboard(errorMessageValue.value)
|
|
}
|
|
}
|
|
|
|
const reportJobError = () => {
|
|
const error = extractExecutionError(taskForJob.value)
|
|
if (error?.detail) {
|
|
dialog.showExecutionErrorDialog(error.detail)
|
|
return
|
|
}
|
|
if (errorMessageValue.value) {
|
|
dialog.showErrorDialog(new Error(errorMessageValue.value), {
|
|
reportType: 'queueJobError'
|
|
})
|
|
}
|
|
}
|
|
|
|
return {
|
|
errorMessageValue,
|
|
copyErrorMessage,
|
|
reportJobError
|
|
}
|
|
}
|