The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Fly around: the server draws the camera path only once ComfyUI answers
Claudedd01fa163fd2
diff --git a/src/server/generations.ts b/src/server/generations.tsindex e1e6a8f5..b6cb8efb 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -1331,19 +1331,6 @@ async function advanceDependents(): Promise<void> {fail(`${earlier} has no ${slots[missing].render ? "depth picture" : slotNoun(slots[missing])} to use`);continue;}- // A camera path drawn through the still's depth on this server (Uni3C's guide where no browser drew one); a demo- // depth step hands on a demo render.- for (let i = 0; i < slots.length; i++) {- if (slots[i].render !== "path") continue;- // The still, once the other slots are in (it can come from an earlier step too: a Canvas node's picture).- const photo = withChainInputs({ ...request, chain: slots }, values as string[]).inputs?.images?.[0];- const keys = request.params?.cameraPath ?? [];- if (deps[i]!.provider === "mock" || !photo) values[i] = placeholderFor(slots[i]);- else {- update(r.id, { message: "Rendering the camera path" });- values[i] = await asRun(() => renderPathVideo({ photo, depth: values[i]!, keys }, r.id));- }- }// Routing reads cached reachability: make sure it's fresh for local engines. An Original counts with the routes of// the engine it runs on, ComfyUI taken as answering: one on the cloud doesn't use it, so doesn't wait for it.const model = getModel(request.modelId);@@ -1363,6 +1350,19 @@ async function advanceDependents(): Promise<void> {if (!back && Date.now() - first! < COMFY_WAIT.ms) continue;}comfyWaits().delete(r.id);+ // A camera path drawn through the still's depth on this server (Uni3C's guide where no browser drew one); a demo+ // depth step hands on a demo render. Only once ComfyUI answers: a sweep that waits for it renders nothing.+ for (let i = 0; i < slots.length; i++) {+ if (slots[i].render !== "path") continue;+ // The still, once the other slots are in (it can come from an earlier step too: a Canvas node's picture).+ const photo = withChainInputs({ ...request, chain: slots }, values as string[]).inputs?.images?.[0];+ const keys = request.params?.cameraPath ?? [];+ if (deps[i]!.provider === "mock" || !photo) values[i] = placeholderFor(slots[i]);+ else {+ update(r.id, { message: "Rendering the camera path" });+ values[i] = await asRun(() => renderPathVideo({ photo, depth: values[i]!, keys }, r.id));+ }+ }if (model?.routes.some((x) => x.provider === "llm")) await probeLocal();// Filled with the slots that have an input; stored with its whole chain (and what was skipped) for a retry.const filled = withChainInputs({ ...request, chain: slots }, values as string[]);diff --git a/tests/comfy-reach.test.ts b/tests/comfy-reach.test.tsindex f61e5cf0..803eece8 100644--- a/tests/comfy-reach.test.ts+++ b/tests/comfy-reach.test.ts@@ -17,6 +17,7 @@ const { REACH } = await import("@/server/providers/reach");const gens = await import("@/server/generations");const { db } = await import("@/server/db");const { saveFile } = await import("@/server/storage");+const { exactOrbitKeys } = await import("@/lib/exact-orbit");const RAM = 16 * 2 ** 30;/** A stand-in ComfyUI: /system_stats answers `status` after `delay` ms (a busy CPU server answers late, but takes the connection). */@@ -230,6 +231,31 @@ describe("a chain step after real ComfyUI steps", () => {expect(done.error ?? "").not.toMatch(/needs ComfyUI to continue/);});+ it("draws a server camera path only once ComfyUI answers, never on a sweep that waits for it", async () => {+ status = 503;+ missed();+ // A depth step that ran on ComfyUI hands on a picture this server can't read: drawing the path would fail the step.+ const still = saveFile({ data: Buffer.from("not really a still"), contentType: "image/png", source: "generation" }).url;+ const g = gens.createGenerations(+ {+ feature: "canvas",+ modelId: "oss-uni3c-path",+ op: "camera-path",+ prompt: "The camera flies around the subject",+ inputs: { images: [still] },+ chain: [{ slot: "video", render: "path" }],+ params: { numOutputs: 1, cameraPath: exactOrbitKeys({ degrees: 90, direction: "cw" }) },+ },+ { dependsOn: ranOnComfy("image") },+ )[0];+ await until(() => gens.getGeneration(g.id)!.message === "Waits for ComfyUI to answer");+ await new Promise((r) => setTimeout(r, 3500));+ const x = gens.getGeneration(g.id)!;+ expect(x.status).toBe("queued");+ expect(x.message).toBe("Waits for ComfyUI to answer");+ await gens.cancelGeneration(g.id);+ });+it("doesn't wait for ComfyUI when the step runs on the cloud (an Original on its cloud engine)", async () => {status = 503;missed();