One-click character swap for videos: an open-source, local Higgsfield Genjutsu alternative built on ComfyUI and MiniMax H3, with FLUX.3 Klein relighting.
Make the setup check read only the graph's nodes
D3voz47c3724fe65d
diff --git a/lib/setup.ts b/lib/setup.tsindex 09b5c1c..b9e87c3 100644--- a/lib/setup.ts+++ b/lib/setup.ts@@ -99,14 +99,16 @@ export function inspectSetup(graph: ApiGraph, registry: NodeRegistry): SetupResureturn result;}+// Full /object_info rebuilds every node's info per request and can take over 20 s on large installs; ask only for the graph's nodes.export async function checkSetup(graph: ApiGraph): Promise<SetupResult> {try {- const [registry, websocketFix] = await Promise.all([- comfyUi("/object_info", 8000),+ const types = [...new Set(Object.values(graph).map((node) => node.class_type))];+ const [answers, websocketFix] = await Promise.all([+ Promise.all(types.map((type) => comfyUi(`/object_info/${encodeURIComponent(type)}`, 8000))),comfyUi("/websocket_reconnect_fix", 8000).then(() => true, () => false),]);- if (!registry || typeof registry !== "object" || Array.isArray(registry)) throw new Error("Invalid node list");- const result = inspectSetup(graph, registry);+ if (answers.some((info) => !info || typeof info !== "object" || Array.isArray(info))) throw new Error("Invalid node info");+ const result = inspectSetup(graph, Object.assign({}, ...answers));if (!websocketFix) Object.assign(result, { ok: false, error: PACK_HINT, packs: [...result.packs, WEBSOCKET_FIX] });return result;} catch {diff --git a/test/setup.test.ts b/test/setup.test.tsindex f8557c4..6365a42 100644--- a/test/setup.test.ts+++ b/test/setup.test.ts@@ -125,15 +125,30 @@ test("model checks deduplicate files, normalize path separators, and ignore uploassert.deepEqual(inspectSetup(graph, registry).models, [{ name: "missing.safetensors", folder: "text_encoders" }]);});-test("setup reads the registry and the websocket fix route, and never uploads or submits a job", async (t) => {+test("setup reads only the graph's nodes and the websocket fix route, and never uploads or submits a job", async (t) => {const graph = setupGraph(load("simple"), simple);+ const registry = registryFor(graph);const urls: string[] = [];t.mock.method(globalThis, "fetch", async (url: string) => {urls.push(url);- return Response.json(url.endsWith("/websocket_reconnect_fix") ? {} : registryFor(graph));+ const type = decodeURIComponent(new URL(url).pathname.replace("/object_info/", ""));+ return Response.json(url.endsWith("/websocket_reconnect_fix") ? {} : { [type]: registry[type] });});assert.equal((await checkSetup(graph)).ok, true);- assert.deepEqual(urls.map((url) => new URL(url).pathname).sort(), ["/object_info", "/websocket_reconnect_fix"]);+ const types = [...new Set(Object.values(graph).map((node) => node.class_type))];+ assert.deepEqual(urls.map((url) => new URL(url).pathname).sort(), [...types.map((type) => `/object_info/${type}`), "/websocket_reconnect_fix"].sort());+});++test("a node ComfyUI does not have comes back empty and is listed as missing", async (t) => {+ const graph = setupGraph(load("simple"), simple);+ const registry = registryFor(graph);+ t.mock.method(globalThis, "fetch", async (url: string) => {+ const type = decodeURIComponent(new URL(url).pathname.replace("/object_info/", ""));+ return Response.json(url.endsWith("/websocket_reconnect_fix") || type === "H3SourceSlice" ? {} : { [type]: registry[type] });+ });+ const result = await checkSetup(graph);+ assert.equal(result.ok, false);+ assert.deepEqual(result.packs.map((p) => [p.name, p.nodes]), [["comfyui-h3-oneclick-swap", ["H3SourceSlice"]]]);});test("setup lists the websocket fix when ComfyUI does not have it", async (t) => {