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
Cinema Studio World mode and Image to 3D Trim spikes say what they run on
Adarsh1643d95af09e
diff --git a/docs/public-signup.md b/docs/public-signup.mdindex 8a13a83f..6dd01b07 100644--- a/docs/public-signup.md+++ b/docs/public-signup.md@@ -306,6 +306,14 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188only the account's own picture, takes no text from the request and saves under a name the server makes; the pagefills the description from that run's text. A guest gets the sign-up card. The checks are`src/server/account-tool-run.ts`.+ The modes and options that haven't yet passed a real render on this studio's GPU (Group swap's "one by one", Object+ swap's Change it, Remove it and New background, From picture with its Light, own person and H3 renderer choices, Fix+ faces, MiniMax H3 Motion transfer, and "Clean the voice first" for the clip's words, in Genjutsu and Character Swap+ Studio) show to everyone, marked with what they run on ("Runs on your own GPU · 24 GB", `src/lib/own-setup.ts`). An+ account runs them on its own GPU (or key, for Clean the voice first); without one it gets "Connect your GPU"+ (`connect-gpu`). The mark leaves by itself once the feature's graphs are validated and its pass is recorded in+ `workflows/comfyui/gpu-tested.json` (`genjutsuLive`, `soundLive`). Cinema Studio's World mode carries the same mark+ until its graph is validated (`src/server/own-setup-live.ts`), and Image to 3D's "Trim spikes" says what it runs on.- **Storyboard.** An account makes boards the same way (`POST /api/storyboards`), and the film of a board(`POST /api/storyboards/<id>/film`). Every frame, shot and join is a run of its own on the account's ComfyUI, or onits own fal.ai or Replicate key on the cloud engine, with only its own pictures as look references, and a board (ordiff --git a/src/app/api/cinema/projects/[id]/route.ts b/src/app/api/cinema/projects/[id]/route.tsindex b6a40f80..90ffa589 100644--- a/src/app/api/cinema/projects/[id]/route.ts+++ b/src/app/api/cinema/projects/[id]/route.ts@@ -3,6 +3,8 @@ import { CinemaError, deleteProject, getProject, listFolders, spentUsd, updatePrimport { ProjectPatch, asCinemaViewer, body, refsRefused } from "@/server/cinema-schemas";import { cinemaContext } from "@/server/cinema-generate";import { worldcastContextNow } from "@/server/worldcast-on";+import { graphsReady } from "@/server/own-setup-live";+import { WORLD_MODEL } from "@/lib/world";/*** The project with its folders, its estimated spend and what this install can run (cloud models allowed, a civitai key).@@ -17,7 +19,9 @@ export async function GET(req: Request, ctx: RouteContext<"/api/cinema/projects/const { cloudAllowed, civitai } = cinemaContext();// The studio's WorldCast worker, for its owner only (N7-9): the Fly path says what it films on.const worldcast = viewer.kind === "owner" ? await worldcastContextNow() : undefined;- return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { cloudAllowed, civitai, ...(worldcast !== undefined && { worldcast }) } });+ // World mode's graph has passed its check on this studio's GPU: its "runs on your own GPU" mark leaves (own-setup.ts).+ const worldReady = graphsReady(WORLD_MODEL);+ return Response.json({ project, folders: listFolders(id), spentUsd: spentUsd(id), context: { cloudAllowed, civitai, worldReady, ...(worldcast !== undefined && { worldcast }) } });});}diff --git a/src/components/cinema/hooks.ts b/src/components/cinema/hooks.tsindex 5989c86a..74889b63 100644--- a/src/components/cinema/hooks.ts+++ b/src/components/cinema/hooks.ts@@ -17,7 +17,8 @@ export interface ProjectView {project: CinemaProject;folders: CinemaFolder[];spentUsd: number;- context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };+ /** worldReady: World mode's graph has passed its check on this studio's GPU (its own-setup mark leaves). */+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean; worldReady?: boolean };}async function json<T>(res: Response): Promise<T> {diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex f6ce20a8..f33e18c5 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -14,7 +14,9 @@ import { PromptInput, ELEMENT_ICONS, type PromptInputHandle } from "@/componentsimport { ShotsEditor } from "@/components/studio/shots-editor";import { ResponsivePanel } from "@/components/studio/responsive-panel";import { useEdgeFade } from "@/components/studio/use-edge-fade";-import { uploadFile, useAssets, useModelAccess, useStatus } from "@/lib/api";+import { uploadFile, useAssets, useIsOwner, useModelAccess, useStatus } from "@/lib/api";+import { OwnSetupMark } from "@/components/own-setup";+import { ownSetupLabel, ownSetupOnly } from "@/lib/own-setup";import { offered } from "@/lib/model-access";import { getModel } from "@/lib/catalog";import {@@ -304,7 +306,7 @@ export interface PromptBarProps {onSettings: (patch: Partial<DirectorSettings>) => void;palettes: { name: string; hex: string[] }[];onPalettes: (p: { name: string; hex: string[] }[]) => void;- context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean };+ context: { cloudAllowed: boolean; civitai?: boolean; worldcast?: boolean; worldReady?: boolean };brief: string;spentUsd: number;costCapUsd: number | null;@@ -328,6 +330,9 @@ const ACTIONS: { id: BarAction; label: string; icon: typeof Video; hint: stringexport function PromptBar(props: PromptBarProps) {const { projectId, folderId, engine, draft, setDraft, settings, onSettings, context, brief, spentUsd, costCapUsd, elements, promptRef } = props;const generate = useCinemaGenerate(projectId);+ // World mode on a visitor's own GPU: its mark until its graph has passed on this studio's GPU (src/lib/own-setup.ts).+ const owner = useIsOwner();+ const worldSetup = !owner && !context.worldReady ? ownSetupOnly("cinema:world") : null;const status = useStatus().data;const [movesOpen, setMovesOpen] = useState(false);const [preparing, setPreparing] = useState(false);@@ -589,9 +594,13 @@ export function PromptBar(props: PromptBarProps) {props.onWorld!();}} className={cn(chip, chipIdle)} aria-label="World: describe a world, then steer it turn by turn"><Globe className="size-3.5" /> World+ {worldSetup && <OwnSetupMark setup={worldSetup} />}</button></TooltipTrigger>- <TooltipContent>World: describe a world once, then steer it turn by turn with words and camera moves (your GPU)</TooltipContent>+ <TooltipContent>+ World: describe a world once, then steer it turn by turn with words and camera moves (your GPU)+ {worldSetup && <span className="block">{ownSetupLabel(worldSetup)}</span>}+ </TooltipContent></Tooltip>)}</>diff --git a/src/components/cinema/world-panel.tsx b/src/components/cinema/world-panel.tsxindex aa7d2721..a3b0ae8b 100644--- a/src/components/cinema/world-panel.tsx+++ b/src/components/cinema/world-panel.tsx@@ -9,6 +9,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } fimport { Input } from "@/components/ui/input";import { Textarea } from "@/components/ui/textarea";import { useStatus } from "@/lib/api";+import { useOwnSetupPress } from "@/components/own-setup";import { planCinema, type CinemaGenerateInput, type DirectorSettings } from "@/lib/catalog/cinema";import type { Engine } from "@/lib/catalog/types";import { placeholdersOn } from "@/lib/demo-mode";@@ -120,7 +121,10 @@ export function WorldPanel(props: WorldPanelProps) {const setTurn = (k: number, patch: Partial<WorldTurn>) =>set((s) => (k === 0 ? { ...s, opening: { ...s.opening, ...patch } } : { ...s, turns: s.turns.map((t, i) => (i === k - 1 ? { ...t, ...patch } : t)) }));- const run = async (k: number) => {+ // A visitor films on its own GPU: a guest gets the sign-up card, an account without one "Connect your GPU".+ const press = useOwnSetupPress();+ const run = (k: number) => void press("cinema:world", () => void film(k));+ const film = async (k: number) => {const problem = engine !== "open" ? "World mode runs on your GPU (open source)" : worldProblem(tidy, k);if (problem) return toast.error(problem);setBusy(k);@@ -133,11 +137,12 @@ export function WorldPanel(props: WorldPanelProps) {setBusy(null);}};- const redo = (k: number) => {- // A little before now: the take's time is the server's clock.- setRedoAt((r) => ({ ...r, [k]: Date.now() - 2000 }));- void run(k);- };+ const redo = (k: number) =>+ void press("cinema:world", () => {+ // A little before now: the take's time is the server's clock.+ setRedoAt((r) => ({ ...r, [k]: Date.now() - 2000 }));+ void film(k);+ });const exportFilm = async () => {if (!exported) return;setBusy("export");diff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsxindex 85a0677a..1f9df461 100644--- a/src/components/model3d/model3d-studio.tsx+++ b/src/components/model3d/model3d-studio.tsx@@ -51,6 +51,7 @@ import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types"import { keepOffered, offered } from "@/lib/model-access";import type { ExampleRowData } from "@/lib/examples/types";import { cn } from "@/lib/utils";+import { OwnSetupChip } from "@/components/own-setup";import { toastError } from "@/lib/refusals";import { priceLine, useCreate3d, useRunPreview } from "./hooks";import { ModelCard } from "./model-card";@@ -177,6 +178,8 @@ function IdolSettings({<Label htmlFor="m3d-idol-trim" className="text-[13px] font-normal">Trim spikes</Label>+ {/* A visitor's run is on its own GPU: what that needs (the owner reads the line below instead). */}+ {!owner && <OwnSetupChip setup="image-to-3d:idol-clean" className="ml-1.5 align-[1px]" />}<p id="m3d-idol-trim-hint" className="mt-0.5 text-[12px] text-muted-foreground">Drops the thin, needle-like bits around the edges of the 3D file.</p>diff --git a/src/server/own-setup-live.ts b/src/server/own-setup-live.tsnew file mode 100644index 00000000..d056c075--- /dev/null+++ b/src/server/own-setup-live.ts@@ -0,0 +1,23 @@+import "server-only";+import fs from "node:fs";+import path from "node:path";+import { getModel } from "@/lib/catalog";++const MANIFEST = path.join(process.cwd(), "workflows", "comfyui", "manifest.json");++/**+ * Whether a model's ComfyUI graphs have all passed their check on this studio's GPU (the manifest's `validated`), read+ * when a page is made. Until then its surface marks it with what it runs on (src/lib/own-setup.ts); the mark leaves by+ * itself once the flags say so. False for a model with no ComfyUI graph, or when the manifest can't be read.+ */+export function graphsReady(modelId: string, manifest = MANIFEST): boolean {+ const graphs = (getModel(modelId)?.routes ?? []).filter((r) => r.provider === "comfyui").map((r) => r.endpoint);+ if (!graphs.length) return false;+ try {+ const m = JSON.parse(fs.readFileSync(manifest, "utf8")) as { workflows?: { id?: string; validated?: boolean }[] };+ const validated = new Set((m.workflows ?? []).filter((w) => w.validated === true).map((w) => w.id));+ return graphs.every((g) => validated.has(g));+ } catch {+ return false;+ }+}diff --git a/tests/own-setup-flags.test.ts b/tests/own-setup-flags.test.tsnew file mode 100644index 00000000..61515254--- /dev/null+++ b/tests/own-setup-flags.test.ts@@ -0,0 +1,67 @@+import fs from "node:fs";+import path from "node:path";+import { describe, expect, it, vi } from "vitest";+import { tempDir } from "./helpers/temp-dir";+import { WORLD_MODEL } from "@/lib/world";++vi.mock("server-only", () => ({}));++/**+ * The "runs on your own setup" marks of the items that wait for a check on this studio's GPU leave by themselves once+ * the flags say so: a recorded pass (workflows/comfyui/gpu-tested.json) or a validated graph (the manifest).+ */+const { graphsReady } = await import("@/server/own-setup-live");+const { genjutsuLive } = await import("@/server/genjutsu-live");++const BANNED = /untested|not tested|unverified|not verified|not validated|validat|isn['’]t available|not available|unavailable|coming soon|held|owner|beta|experimental|soon/i;++describe("own setup: the marks follow the GPU checks", () => {+ it("marks Cinema's World mode until its graph is validated, then drops the mark", async () => {+ const { ownSetupLabel, ownSetupOnly } = await import("@/lib/own-setup");+ const d = tempDir("fuobe-own-setup-flags-");+ const manifest = (validated: boolean) => {+ const file = path.join(d, `m-${validated}.json`);+ fs.writeFileSync(file, JSON.stringify({ workflows: [{ id: "world-hy-nomas-turn", validated }] }));+ return file;+ };+ expect(graphsReady(WORLD_MODEL)).toBe(false);+ expect(graphsReady(WORLD_MODEL, manifest(false))).toBe(false);+ expect(graphsReady(WORLD_MODEL, manifest(true))).toBe(true);+ expect(graphsReady(WORLD_MODEL, path.join(d, "none.json"))).toBe(false);+ // A model with no graph of its own is never "ready" by this check.+ expect(graphsReady("nano-banana-pro", manifest(true))).toBe(false);+ const o = ownSetupOnly("cinema:world");+ expect(o).not.toBeNull();+ expect(ownSetupLabel(o!)).toBe("Runs on your own GPU · 24 GB");+ expect(ownSetupLabel(o!)).not.toMatch(BANNED);+ });++ it("opens a Genjutsu feature, and drops its mark, once its graph is validated and its pass recorded", () => {+ const d = tempDir("fuobe-own-setup-gj-");+ const files = (validated: boolean, passed: boolean) => {+ fs.writeFileSync(path.join(d, "m.json"), JSON.stringify({ workflows: ["image-from-picture-prepare", "video-scene-describe", "video-from-picture-solar"].map((id) => ({ id, validated })) }));+ fs.writeFileSync(path.join(d, "r.json"), JSON.stringify({ features: { picture: { passed } } }));+ return [path.join(d, "m.json"), path.join(d, "r.json")] as const;+ };+ expect(genjutsuLive().picture).toBe(false);+ expect(genjutsuLive(...files(true, false)).picture).toBe(false);+ expect(genjutsuLive(...files(false, true)).picture).toBe(false);+ expect(genjutsuLive(...files(true, true)).picture).toBe(true);+ });++ it("drops an item's label once gpu-tested.json records its pass", async () => {+ const before = await import("@/lib/own-setup");+ const ids = ["genjutsu:picture", "genjutsu:finish-faces", "oss-h3-motion", "sound:clean-voice-first"];+ for (const id of ids) expect(before.ownSetupOnly(id), id).not.toBeNull();+ vi.resetModules();+ vi.doMock("../workflows/comfyui/gpu-tested.json", () => ({+ default: { features: { picture: { passed: true }, "finish-faces": { passed: true }, "motion-h3": { passed: true }, "clean-voice-first": { passed: true } } },+ }));+ const after = await import("@/lib/own-setup");+ for (const id of ids) expect(after.ownSetupOnly(id), id).toBeNull();+ // An item with no pass to wait for keeps its label (the 48 GB card, the Linux worker).+ expect(after.ownSetupOnly("oss-h3-regenerate")).not.toBeNull();+ vi.doUnmock("../workflows/comfyui/gpu-tested.json");+ vi.resetModules();+ });+});