Fix V2 identity queue validation by filling unused ref slots.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-26 23:18:45 -05:00
co-authored by Cursor
parent d280985553
commit 054c07ae03
4 changed files with 27 additions and 13 deletions
@@ -3,7 +3,6 @@
"inputs": {
"filename_prefix": "video/MiniMax_H3",
"format": "auto",
"format.codec": "auto",
"codec": "auto",
"video": [
"172",
+24 -4
View File
@@ -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 }
}
+2 -7
View File
@@ -234,13 +234,8 @@ function applyV2IdentityPath(
graph['176'].inputs.lora_name = 'minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors'
}
V2_REF_LOADERS.forEach((id, index) => {
const name = refs[index]
if (name && graph[id]) {
graph[id].inputs.image = name
return
}
delete graph[id]
if (graph['155']?.inputs) delete graph['155'].inputs[`ref_images.ref_image_${index + 1}`]
if (!graph[id]) return
graph[id].inputs.image = refs[index] || params.imageName
})
if (graph['150']?.inputs) graph['150'].inputs.value = true
return