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
Assist: film a world walk-through on your GPU, turn after turn, joined into one film
Claude79a426f6c178
diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.tsindex 6967cd31..892a8f1c 100644--- a/src/lib/catalog/cinema.ts+++ b/src/lib/catalog/cinema.ts@@ -2548,6 +2548,26 @@ function planWorld(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPlan {return finish(model, [{ key: "main", request }], notes);}+/**+ * A whole World film in one go (Assist's world_film): every turn in order, each after the one before (so ComfyUI still+ * holds the turns it continues from), then the turns joined into one film. Throws what stops it.+ */+export function worldFilmSteps(script: WorldScript, engine: Engine): CinemaStep[] {+ if (engine !== "open") throw new Error(WORLD_OPEN_ONLY);+ const s = normalizeWorld(script);+ const steps: CinemaStep[] = [];+ for (let k = 0; k <= s.turns.length; k++) {+ const plan = planWorld({ engine, mode: "video", action: "world", prompt: "", settings: {}, world: { script: s, turn: k } }, {});+ if (plan.blocker) throw new Error(plan.blocker);+ steps.push({ key: `turn${k}`, ...(k ? { after: [`turn${k - 1}`] } : {}), request: plan.steps[0].request });+ }+ if (steps.length > 1) {+ const keys = steps.map((x) => x.key);+ steps.push({ key: "join", after: keys, request: { feature: "cinema-world", modelId: WORLD_JOIN, op: "concat", prompt: "World film", params: { numOutputs: 1 }, chain: keys.map(() => ({ slot: "videos" as const })) } });+ }+ return steps;+}+/** What a World take remembers: its turn, the script up to it and that part's key; or that it is the joined film. */export function worldTake(input: Pick<CinemaGenerateInput, "world">): CinemaTakeInfo["world"] {const run = input.world;diff --git a/src/server/assist/agent.ts b/src/server/assist/agent.tsindex 35ac823f..faab8a3c 100644--- a/src/server/assist/agent.ts+++ b/src/server/assist/agent.ts@@ -705,7 +705,7 @@ How you work:- Call generate (or create_storyboard) directly. The app shows the user a plan card with the cost and runs it when they approve — never ask "shall I go ahead?" in text.- For multi-step work (an image, then animate it; transcribe, translate, then voice it), put the steps in one generate call and set "after" on each later job: it starts by itself when the earlier job finishes and gets its result as input. When you need to judge a result before deciding the next step, wait with check_generations instead (look=true to see images) and pass the output URL into the next call.- Besides images, video and audio, models can transcribe speech, translate or write text (scripts, captions, ad copy), split images into layers, separate voice from background, trim, caption or re-sound clips, and turn an image into a 3D model: search_models with kind "text" or "model3d" finds the text and 3D ones.-- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), remove_person (a person removed from a video and the scene rebuilt behind them, on the user's own GPU, in Remove a person), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library), fly_around (a still filmed along an exact camera path: an orbit by its degrees, direction, tilt and pulse, or a ready move; in the Library), edit_speech (a word, the pitch, pace, mood or noise of a recording or video changed without re-recording it, on the user's GPU; pass the transcript's timed lines) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).+- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), remove_person (a person removed from a video and the scene rebuilt behind them, on the user's own GPU, in Remove a person), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library), fly_around (a still filmed along an exact camera path: an orbit by its degrees, direction, tilt and pulse, or a ready move; in the Library), edit_speech (a word, the pitch, pace, mood or noise of a recording or video changed without re-recording it, on the user's GPU; pass the transcript's timed lines), world_film (a world walk-through: a world described once, then steered turn by turn with words and camera moves, joined into one film, on the user's GPU; "a 60 s walk-through" is the opening and four 12 s turns; in the Library) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).- Use the user's files by the URLs listed in their message. Earlier outputs are found with list_recent. Saved characters and products are Elements: check list_elements and write their @handle in prompts.- Results show up in the chat by themselves, so don't repeat URLs back. After starting jobs, say briefly what's coming; after they finish, give a short take and suggest a next step.- Be brief and friendly. Plain sentences, no headings. Prices are estimates in USD; open-source models run free on the user's own GPU.diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.tsindex 323cf2a1..b70e9168 100644--- a/src/server/assist/studio-tools.ts+++ b/src/server/assist/studio-tools.ts@@ -12,7 +12,8 @@ import { offlineRestorePrompt, RESTORE, restoreNegative } from "@/lib/catalog/reimport { SHORTS_MODELS } from "@/lib/catalog/shorts";import type { ChainSlot, Engine, GenerationRequest, Operation } from "@/lib/catalog/types";import { TOOL_MODELS } from "@/lib/layers";-import { planCinema } from "@/lib/catalog/cinema";+import { planCinema, worldFilmSteps } from "@/lib/catalog/cinema";+import { normalizeWorld, PERSPECTIVES, STYLES as WORLD_STYLES, WORLD_LIMITS, WORLD_MODEL, WORLD_MOVES, type Perspective, type WorldScript, type WorldStyle } from "@/lib/world";import { FLY_VIEWS_MAX, planFlyAround } from "@/lib/catalog/fly-around";import { PATH_PRESETS } from "@/lib/camera-path";import { createPipeline, type PipelineStep } from "../chains";@@ -822,6 +823,69 @@ const blockoutFilm = defineTool({},});+// ---------------------------------------------------------------------------+// World mode (nm10-hy-nomas-world): Hy-Nomas on your GPU, turn after turn, joined into one film++const WorldTurnInput = z.object({+ words: z.string().max(WORLD_LIMITS.maxWords).describe("What changes in this turn, e.g. 'a wooden bridge crosses a glowing stream ahead'. Can be empty when the camera move alone steers the turn."),+ action: z.string().max(WORLD_LIMITS.maxWords).optional().describe("What the subject does during the turn."),+ move: z.string().optional().describe(`The camera move: ${WORLD_MOVES.map((m) => m.id).join(", ")} (still = the camera stays put).`),+ seconds: z.number().min(WORLD_LIMITS.minSeconds).max(WORLD_LIMITS.maxSeconds).optional().describe(`Seconds, ${WORLD_LIMITS.minSeconds}–${WORLD_LIMITS.maxSeconds} (default 12).`),+});+const WorldFilmInput = z.object({+ scene: z.string().min(1).max(WORLD_LIMITS.maxScene).describe("The world the film starts in, in words: place, light, weather, what is in view."),+ subject: z.string().max(120).optional().describe("Who or what the camera follows (optional), e.g. 'a small orange fox'."),+ details: z.string().max(WORLD_LIMITS.maxWords).optional().describe("How the subject looks."),+ action: z.string().max(WORLD_LIMITS.maxWords).optional().describe("What happens in the opening."),+ perspective: z.enum(PERSPECTIVES.map((p) => p.id) as [Perspective, ...Perspective[]]).optional().describe("The camera: third-person follow (default), third-person observer, first-person or second-person."),+ style: z.enum(WORLD_STYLES.map((p) => p.id) as [WorldStyle, ...WorldStyle[]]).optional().describe("The look (default real-world footage)."),+ move: z.string().optional().describe("The opening's camera move (default zoom_in)."),+ seconds: z.number().min(WORLD_LIMITS.minSeconds).max(WORLD_LIMITS.maxSeconds).optional().describe("The opening's seconds (default 12)."),+ turns: z.array(WorldTurnInput).max(WORLD_LIMITS.maxTurns - 1).describe(`The turns after the opening, in order. A 60 s walk-through is the opening and four turns of 12 s; up to ${WORLD_LIMITS.maxTotal} s in all.`),+ seed: z.number().int().min(0).optional(),+});+export type WorldFilmToolInput = z.infer<typeof WorldFilmInput>;++/** The tool's arguments as a World script. */+export function worldFilmScript(i: WorldFilmToolInput): WorldScript {+ return normalizeWorld({+ opening: { words: i.scene, subject: i.subject, details: i.details, action: i.action, perspective: i.perspective, style: i.style, move: i.move ?? "zoom_in", seconds: i.seconds ?? 12 },+ turns: i.turns.map((t) => ({ words: t.words, action: t.action, move: t.move ?? "still", seconds: t.seconds ?? 12 })),+ seed: i.seed ?? Math.floor(Math.random() * 2 ** 31),+ });+}++/** The film's steps: on your GPU whatever the chat's engine (no cloud service runs Hy-Nomas); "Paid APIs only" refuses it. */+function worldFilmSteps_(i: WorldFilmToolInput): PipelineStep[] {+ return worldFilmSteps(worldFilmScript(i), engineMode() === "cloud" ? "cloud" : "open").map((s) => ({ key: s.key, request: s.request, ...(s.after?.length && { after: s.after }) }));+}++const worldFilm = defineTool({+ name: "world_film",+ description:+ "Film a world walk-through — Fuobe's World mode (Cinema Studio → World): Hy-Nomas (Tencent, open source) on your GPU starts a world from words, then continues it turn by turn, each turn steered by what changes, what the subject does and a camera move from the fly-path library (orbits, arcs, dollies, trucks, figure-8, or still); the turns are joined into one film, 1280 × 704 at 24 fps. " ++ "Free on your GPU (about 24 GB; it runs on no cloud service), silent (add sound with Sound for video or Music afterwards). For 'a 60 s world walk-through' pass the opening and four turns of 12 s. Gated by the same approval card as generate.",+ schema: WorldFilmInput,+ gated: true,+ title: (i) => `World: ${i.scene}`.slice(0, 80),+ plan: (i) => {+ try {+ return planSteps("world_film", worldFilmSteps_(i));+ } catch (e) {+ return [{ tool: "world_film", modelId: WORLD_MODEL, modelName: "World", kind: "video", op: "world-turn", prompt: "World", count: 0, costUsd: 0, demo: false, atomic: true, error: (e as Error).message }];+ }+ },+ async run(i) {+ let steps: PipelineStep[];+ try {+ steps = worldFilmSteps_(i);+ } catch (e) {+ return { content: JSON.stringify({ error: (e as Error).message }), isError: true };+ }+ return startPipeline("World", steps, `World: ${i.scene}`.slice(0, 200));+ },+});+// ---------------------------------------------------------------------------// Edit speech (nm10-speech-edit): Tencent AuK on your GPU@@ -973,7 +1037,7 @@ const flyAround = defineTool({},});-export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, removePerson, blockoutFilm, flyAround, editSpeech];+export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, removePerson, blockoutFilm, flyAround, editSpeech, worldFilm];/** For tests: the fallback pipelines, as they would be created. */export const fallbackSteps = { restore: restoreSteps, layers: layerSteps, restyle: restyleSteps, dub: dubSteps, faceless: facelessSteps, captions: captionSteps, ads: adRequests, blockout: blockoutSteps, flyAround: flyAroundSteps };diff --git a/tests/assist-context.test.ts b/tests/assist-context.test.tsindex 81cc15ba..95574b18 100644--- a/tests/assist-context.test.ts+++ b/tests/assist-context.test.ts@@ -383,13 +383,17 @@ describe("studio tools", () => {{ video, seconds: 8, beats: [{ start: 0, label: "Arrival", words: "She walks in." }] },{ video, seconds: 40, beats: [{ start: 0, label: "Arrival" }, { start: 20, label: "Lights out" }], references: [{ url: image, role: "character", name: "Mara" }], model: "minimax-h3-max-3d", sounds: ["Footsteps"] },],+ world_film: [+ { scene: "A stone path through a forest at dusk, blue fireflies between mossy trees", turns: [] },+ { scene: "A harbour at dawn", subject: "a fishing boat", turns: [{ words: "the fog lifts", move: "orbit_90_ccw", seconds: 12 }, { words: "gulls circle the mast", move: "zoom_in" }, { words: "", move: "truck_left", seconds: 6 }], seed: 3 },+ ],edit_speech: [{ media: video, kind: "video", transcript: [{ start: 0, end: 2.4, text: "We open on Tuesday." }, { start: 3, end: 5, text: "Everyone is welcome." }], changes: [{ line: 0, text: "We open on Thursday." }] },{ media: video, kind: "video", transcript: [{ start: 0, end: 2.4, text: "We open on Tuesday." }], effect: { kind: "pitch", semitones: 2 }, range: { start: 0, end: 2.4 } },],};/** Tools that run on your GPU only: "Paid APIs only" refuses them on the card, with the reason. */- const OPEN_ONLY = new Set(["edit_speech"]);+ const OPEN_ONLY = new Set(["edit_speech", "world_film"]);it("every studio tool plans without errors on both engines in demo mode", () => {expect(Object.keys(SAMPLES).sort()).toEqual(studio.STUDIO_TOOLS.map((t) => t.name).sort());diff --git a/tests/world-mode.test.ts b/tests/world-mode.test.tsindex e6977307..ea8a4635 100644--- a/tests/world-mode.test.ts+++ b/tests/world-mode.test.ts@@ -329,6 +329,19 @@ describe("Cinema's World take", () => {expect(refused.status).toBe(422);});+ it("films a 60 s walk-through for Assist: five 12 s turns, each after the one before, then joined", async () => {+ const { worldFilmSteps } = await import("@/lib/catalog/cinema");+ const { worldFilmScript } = await import("@/server/assist/studio-tools");+ const s = worldFilmScript({ scene: "A stone path through a forest at dusk", turns: Array.from({ length: 4 }, (_, i) => ({ words: `turn ${i + 1}`, move: "orbit_90_ccw" })), seed: 9 });+ expect(W.worldSeconds(s)).toBe(60);+ const steps = worldFilmSteps(s, "open");+ expect(steps.map((x) => x.key)).toEqual(["turn0", "turn1", "turn2", "turn3", "turn4", "join"]);+ expect(steps[3].after).toEqual(["turn2"]);+ expect(steps[3].request.params?.extra).toMatchObject({ turn: 3, world: { seed: 9 } });+ expect(steps[5]).toMatchObject({ after: ["turn0", "turn1", "turn2", "turn3", "turn4"], request: { modelId: W.WORLD_JOIN, op: "concat" } });+ expect(() => worldFilmSteps(s, "cloud")).toThrow(WORLD_OPEN_ONLY);+ });+it("has a row on the GPU pre-flight board", () => {const row = STUDIO_ROWS.find((r) => r.href === "/cinema?world=1")!;expect(row).toMatchObject({ label: "World mode", group: "Video" });