Skip to content

中文版 AI 姿势参考图库 · 1439 组 / 2878 张图片 / 完整汉化 · 零依赖静态画廊

fix: handle ComfyUI V3 autogrow inputs in workflow precheck

H-Bole9b64910140dc
diff --git a/src/services/aiGenerator.ts b/src/services/aiGenerator.ts
index dd45296..6f14f19 100644
--- a/src/services/aiGenerator.ts
+++ b/src/services/aiGenerator.ts
@@ -851,7 +851,10 @@ export async function checkComfyWorkflow(
const infoEntries = await Promise.all(
classes.map(async (cls) => {
const res = await comfyFetch(base, `/object_info/${encodeURIComponent(cls)}`, {}, apiKey, 15000)
- const json = res.ok ? await readJsonSafe(res) : {}
+ if (!res.ok) {
+ throw new Error(`[ComfyUI] 无法读取节点「${cls}」的定义(HTTP ${res.status}),请检查连接地址、访问令牌和网关接口权限。`)
+ }
+ const json = await readJsonSafe(res)
return [cls, json?.[cls]] as const
})
)
@@ -876,7 +879,20 @@ export async function checkComfyWorkflow(
const optional = def.input?.optional || {}
const inputs = node.inputs || {}
- for (const name of Object.keys(required)) {
+ for (const [name, spec] of Object.entries<any>(required)) {
+ // V3 自动扩展组使用 images.image_1 等扁平输入,组名本身不参与执行。
+ if (spec?.[0] === 'COMFY_AUTOGROW_V3') {
+ const template = spec[1]?.template
+ if (template?.input?.required) {
+ for (let i = 0; i < (template.min ?? 0); i++) {
+ const child = template.names?.[i] ?? `${template.prefix}${i}`
+ if (!(`${name}.${child}` in inputs)) {
+ errors.push(`节点 ${id}「${title}」缺少必填输入 ${name}.${child}`)
+ }
+ }
+ }
+ continue
+ }
if (!(name in inputs)) errors.push(`节点 ${id}「${title}」缺少必填输入 ${name}`)
}