Fix V2 identity queue validation by filling unused ref slots.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+24
-4
@@ -77,6 +77,29 @@ export function comfyInputFilename(original: string, jobId?: string) {
|
||||
return `aigen_${id}_${base}${ext}`
|
||||
}
|
||||
|
||||
function comfyQueueMessage(payload: unknown, status: number) {
|
||||
const body = payload as {
|
||||
error?: { message?: string; details?: string }
|
||||
node_errors?: Record<string, {
|
||||
class_type?: string
|
||||
errors?: Array<{ message?: string; details?: string; extra_info?: { input_name?: string } }>
|
||||
}>
|
||||
}
|
||||
const parts: string[] = []
|
||||
const headline = String(body.error?.message || '').trim()
|
||||
const extra = String(body.error?.details || '').trim()
|
||||
if (headline) parts.push(headline)
|
||||
if (extra) parts.push(extra)
|
||||
for (const [id, node] of Object.entries(body.node_errors || {})) {
|
||||
for (const item of node.errors || []) {
|
||||
const bit = [item.message, item.details, item.extra_info?.input_name].filter(Boolean).join(' — ')
|
||||
if (bit) parts.push(`${node.class_type || `Node ${id}`}: ${bit}`)
|
||||
}
|
||||
}
|
||||
const message = [...new Set(parts.filter(Boolean))].join('. ')
|
||||
return message || `Queue failed (${status})`
|
||||
}
|
||||
|
||||
export async function queuePrompt(graph: unknown, clientId: string) {
|
||||
const res = await comfyFetch('/prompt', {
|
||||
method: 'POST',
|
||||
@@ -85,10 +108,7 @@ export async function queuePrompt(graph: unknown, clientId: string) {
|
||||
})
|
||||
const payload = await res.json().catch(() => ({}))
|
||||
if (!res.ok) {
|
||||
const message = (payload as { error?: { message?: string } }).error?.message
|
||||
|| (payload as { node_errors?: unknown }).node_errors
|
||||
|| `Queue failed (${res.status})`
|
||||
throw createError({ statusCode: 502, statusMessage: String(message), data: payload })
|
||||
throw createError({ statusCode: 502, statusMessage: comfyQueueMessage(payload, res.status), data: payload })
|
||||
}
|
||||
return payload as { prompt_id: string; number?: number }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user