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
Home and Storyboard: compact Recent strip, more tools, one-per-category effects; board names on the server
Claude3532b72afeb9
diff --git a/src/app/(studio)/page.tsx b/src/app/(studio)/page.tsxindex f84aabd7..b03a86c4 100644--- a/src/app/(studio)/page.tsx+++ b/src/app/(studio)/page.tsx@@ -1,6 +1,6 @@import { HomeView } from "@/components/home-view";import { APPS, EFFECTS, MOTIONS } from "@/lib/catalog";-import { toPresetCard } from "@/lib/preset-cards";+import { homeEffects, toPresetCard } from "@/lib/preset-cards";const HOME_MOTIONS = ["motion-crash-zoom-in", "motion-360-orbit", "motion-bullet-time", "motion-fpv-drone", "motion-dolly-zoom-in", "motion-snorricam"];@@ -14,7 +14,7 @@ export default function Page() {.filter((a) => a.badges?.includes("top") || a.category === "Camera").slice(0, 6).map(toPresetCard)}- effects={EFFECTS.slice(0, 6).map(toPresetCard)}+ effects={homeEffects(EFFECTS, 6).map(toPresetCard)}/>);}diff --git a/src/components/home-view.tsx b/src/components/home-view.tsxindex e08b6825..4810c49f 100644--- a/src/components/home-view.tsx+++ b/src/components/home-view.tsx@@ -1,19 +1,37 @@"use client";import Link from "next/link";-import { ArrowRight, AudioLines, Film, ImageIcon, Mic2, ScanFace, Sparkles, Video, Wand2, ZoomIn } from "lucide-react";+import {+ ArrowRight,+ AudioLines,+ CircleAlert,+ Clapperboard,+ Film,+ GalleryHorizontal,+ ImageIcon,+ Loader2,+ Mic2,+ Network,+ ScanFace,+ Sparkles,+ Video,+ Wand2,+ ZoomIn,+} from "lucide-react";import { useRouter } from "next/navigation";import { lazy, Suspense, useState } from "react";import { PageShell } from "@/components/page-shell";import { PresetCard } from "@/components/preset-gallery";-import { Skeleton } from "@/components/ui/skeleton";+import { MediaThumb } from "@/components/studio/result-media";import { useEngine, useGenerations, useHydrated, useStatus } from "@/lib/api";import { EngineSwitch } from "@/components/studio/engine-switch";+import type { Generation } from "@/lib/catalog/types";+import { userTitle } from "@/lib/library";import type { PresetCardData } from "@/lib/preset-cards";import { cn } from "@/lib/utils";-// The feed (and the viewer behind it) is only needed once there is something recent to show.-const Feed = lazy(() => import("@/components/studio/feed").then((m) => ({ default: m.Feed })));+// The viewer is only needed once a recent result is opened.+const Viewer = lazy(() => import("@/components/studio/viewer").then((m) => ({ default: m.Viewer })));const MODES = [{ id: "image", label: "Image", icon: ImageIcon, href: "/image", placeholder: "Describe an image…" },@@ -27,17 +45,73 @@ interface Counts {apps: number;}-/** Tool tiles. Append one entry per new destination; the grid fits any count. */+/** Tool tiles. Append one entry per new destination (the grid holds five per row on wide screens). */const tools = (c: Counts) => [+ { href: "/cinema", label: "Cinema Studio", desc: "Direct a film shot by shot", icon: Clapperboard, hue: 330 },{ href: "/motions", label: "Camera motions", desc: `${c.motions} director moves`, icon: Film, hue: 280 },{ href: "/effects", label: "Effects", desc: `${c.effects} viral VFX`, icon: Sparkles, hue: 20 },{ href: "/apps", label: "Apps", desc: `${c.apps} one-click tools`, icon: Wand2, hue: 200 },+ { href: "/storyboard", label: "Storyboard", desc: "One idea, consistent frames", icon: GalleryHorizontal, hue: 100 },+ { href: "/canvas", label: "Canvas", desc: "Chain steps into a flow", icon: Network, hue: 260 },{ href: "/lipsync", label: "Lipsync", desc: "Talking avatars", icon: Mic2, hue: 150 },{ href: "/elements", label: "Elements", desc: "@ characters, places, props", icon: ScanFace, hue: 320 },{ href: "/upscale", label: "Upscale", desc: "Images & video", icon: ZoomIn, hue: 240 },{ href: "/audio", label: "Audio", desc: "Voice, SFX, music", icon: AudioLines, hue: 60 },];+/** The latest results as a compact strip of square thumbnails; a tap opens the viewer. */+function RecentStrip({ items }: { items: Generation[] }) {+ const [open, setOpen] = useState<string | null>(null);+ const viewable = items.filter((g) => g.status === "succeeded" && g.outputs[0]);+ const pos = viewable.findIndex((g) => g.id === open);+ return (+ <>+ <ul className="grid grid-cols-3 gap-2 sm:grid-cols-6">+ {items.map((g) => {+ const title = userTitle(g);+ const ok = g.status === "succeeded" && g.outputs[0];+ const failed = g.status === "failed" || g.status === "canceled";+ return (+ <li key={g.id} className="min-w-0">+ {ok ? (+ <button+ type="button"+ onClick={() => setOpen(g.id)}+ title={title}+ aria-label={`Open “${title}”`}+ className="relative block aspect-square w-full cursor-zoom-in overflow-hidden rounded-xl bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <MediaThumb output={g.outputs[0]} g={g} />+ </button>+ ) : (+ <Link+ href="/library"+ title={title}+ aria-label={`${failed ? "Failed" : "In progress"}: “${title}” — open the Library`}+ className="grid aspect-square w-full place-items-center rounded-xl border border-dashed bg-muted/40 text-muted-foreground"+ >+ {failed ? <CircleAlert className="size-5" /> : <Loader2 className="size-5 animate-spin" />}+ </Link>+ )}+ </li>+ );+ })}+ </ul>+ {pos >= 0 && (+ <Suspense fallback={null}>+ <Viewer+ generation={viewable[pos]}+ index={0}+ onClose={() => setOpen(null)}+ onPrev={pos > 0 ? () => setOpen(viewable[pos - 1].id) : undefined}+ onNext={pos < viewable.length - 1 ? () => setOpen(viewable[pos + 1].id) : undefined}+ />+ </Suspense>+ )}+ </>+ );+}+function Row({ title, href, children }: { title: string; href: string; children: React.ReactNode }) {return (<section className="space-y-3">@@ -52,11 +126,11 @@ function Row({ title, href, children }: { title: string; href: string; children:);}-function CardRow({ cards, href }: { cards: PresetCardData[]; href: (c: PresetCardData) => string }) {+function CardRow({ cards, href, engine }: { cards: PresetCardData[]; href: (c: PresetCardData) => string; engine?: "cloud" | "open" }) {return (<div className="grid grid-cols-2 gap-1 sm:grid-cols-4 lg:grid-cols-6">{cards.map((p) => (- <PresetCard key={p.id} preset={p} href={href(p)} compact />+ <PresetCard key={p.id} preset={p} href={href(p)} compact engine={engine} />))}</div>);@@ -77,6 +151,8 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; mconst comfyReady = !!status?.providers.comfyui?.configured;const nothingConnected = status && !(engineMode === "open" ? comfyReady : engineMode === "cloud" ? cloudReady : cloudReady || comfyReady);+ const locked = engineMode === "both" ? undefined : engineMode;+const go = () => router.push(`${mode.href}${prompt.trim() ? `?prompt=${encodeURIComponent(prompt.trim())}` : ""}`);return (@@ -145,7 +221,7 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; m)}</div>- <div className="mt-14 grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-[repeat(auto-fit,minmax(128px,1fr))]">+ <div className="mt-14 grid grid-cols-2 gap-2 sm:grid-cols-5">{tools(counts).map((t) => (<Link key={t.href} href={t.href} className="group flex min-w-0 flex-col gap-2 rounded-xl border bg-background p-3 transition-colors hover:bg-accent"><span className="grid size-9 place-items-center rounded-lg text-white" style={{ background: `linear-gradient(135deg, oklch(0.75 0.15 ${t.hue}), oklch(0.55 0.2 ${t.hue + 40}))` }}>@@ -162,26 +238,17 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; m<div className="mt-14 space-y-12">{!!recent.data?.length && (<Row title="Recent" href="/library">- <Suspense- fallback={- <div className="flex gap-2">- <Skeleton className="h-56 w-56 rounded-xl" />- <Skeleton className="h-56 w-56 rounded-xl" />- </div>- }- >- <Feed items={recent.data.slice(0, 3)} />- </Suspense>+ <RecentStrip items={recent.data.slice(0, 6)} /></Row>)}<Row title="Camera motions" href="/motions">- <CardRow cards={motions} href={(p) => `/video?preset=${p.id}`} />+ <CardRow cards={motions} href={(p) => `/video?preset=${p.id}`} engine={locked} /></Row><Row title="Popular apps" href="/apps">- <CardRow cards={apps} href={(p) => `/apps/${p.id}`} />+ <CardRow cards={apps} href={(p) => `/apps/${p.id}`} engine={locked} /></Row><Row title="Effects" href="/effects">- <CardRow cards={effects} href={(p) => `/video?preset=${p.id}`} />+ <CardRow cards={effects} href={(p) => `/video?preset=${p.id}`} engine={locked} /></Row></div></PageShell>diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsxindex f62fd0b7..203edb55 100644--- a/src/components/storyboard-view.tsx+++ b/src/components/storyboard-view.tsx@@ -158,7 +158,7 @@ function Board({idea?: string;names: Record<string, string>;}) {- const { remove } = useGenerationActions();+ const { trash } = useGenerationActions();const qc = useQueryClient();const first = frames[0];const done = frames.filter((f) => f.status === "succeeded").length;@@ -207,10 +207,9 @@ function Board({variant="ghost"size="sm"className="text-muted-foreground hover:text-destructive"- onClick={() => {- [...frames, ...film].forEach((f) => void remove(f));- toast("Storyboard deleted");- }}+ aria-label="Delete storyboard"+ // One bulk call, and the shared toast with Undo (the frames go to the Trash).+ onClick={() => void trash([...frames, ...film], "Storyboard moved to Trash")}><Trash2 /> <span className="hidden sm:inline">Delete</span></Button>@@ -309,7 +308,7 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s<EngineSwitch value={engine} onChange={setEngine} /></div></header>- <main className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 space-y-10 px-3 pb-16 sm:px-6">+ <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 space-y-10 px-3 pb-16 sm:px-6"><div className="mx-auto max-w-[820px] pt-6 text-center"><h2 className="font-heading text-display text-balance">Tell it frame by frame</h2><p className="mt-2 text-[13px] text-muted-foreground">@@ -444,7 +443,7 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s<p className="mt-2 text-[14px]">Your storyboards appear here.</p></div>)}- </main>+ </div>{open && pos >= 0 && (<Viewergeneration={flat[pos]}diff --git a/src/lib/storyboard-board.ts b/src/lib/storyboard-board.tsindex aef400fb..c3b9817d 100644--- a/src/lib/storyboard-board.ts+++ b/src/lib/storyboard-board.ts@@ -18,13 +18,22 @@ const cap = (s: string) => (s ? s[0].toUpperCase() + s.slice(1) : s);*/export function boardTitle(frames: Generation[], remembered?: string | null): string {const first = frames[0];- const own = (first?.request as { title?: string } | undefined)?.title?.trim();+ const req = first?.request as { title?: string; batchTitle?: string } | undefined;+ const own = req?.title?.trim() || req?.batchTitle?.trim();if (own) return cap(own);if (remembered?.trim()) return cap(remembered.trim());const scene = first?.request.frame?.scene;return cap(scene ? unwrapScene(scene) : (first?.request.prompt ?? "Storyboard"));}+/**+ * The name the server stores on a new board (every frame's `batchTitle`, the film's title): the+ * user's idea, or their first scene when they wrote it scene by scene.+ */+export function storyboardName(story: string | undefined, scenes: string[]): string {+ return (story?.trim() || scenes.find((s) => s.trim()) || "Storyboard").trim().replace(/\s+/g, " ").slice(0, 200);+}+/** A film needs every frame finished (and at least two of them). */export function filmReady(frames: Generation[]): boolean {return frames.length > 1 && frames.every((f) => f.status === "succeeded" && !!f.outputs[0]);diff --git a/src/server/storyboard.ts b/src/server/storyboard.tsindex ed733877..93016ba0 100644--- a/src/server/storyboard.ts+++ b/src/server/storyboard.ts@@ -1,7 +1,8 @@import "server-only";import { nanoid } from "nanoid";import { framePrompt, heuristicScenes, MAX_FRAMES, parseScenes, SPLIT_SYSTEM, STORYBOARD_MODELS } from "@/lib/catalog/storyboard";-import type { Engine, Generation } from "@/lib/catalog/types";+import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types";+import { storyboardName } from "@/lib/storyboard-board";import { supportsOp } from "@/lib/catalog";import { filmModel, joinClips } from "./chains";import { llmText } from "./enhance";@@ -33,6 +34,8 @@ export async function createStoryboard(r: StoryboardRequest): Promise<{ batchId:const refs = (r.references ?? []).slice(0, 4);const m = STORYBOARD_MODELS[r.engine];const batchId = nanoid(10);+ // The board is named after the user's idea on every device (the Library's stack title too).+ const batchTitle = storyboardName(r.scenes?.length ? undefined : r.story, scenes);const params = { aspectRatio: r.aspectRatio, resolution: r.resolution, numOutputs: 1 };const items: Generation[] = [];let previous: string | undefined;@@ -40,18 +43,17 @@ export async function createStoryboard(r: StoryboardRequest): Promise<{ batchId:const first = i === 0;// The open next-scene workflow takes the previous panel plus one character reference.const frameRefs = first ? refs : m.chainFrom === "first" ? refs.slice(0, 1) : refs;- const [g] = createGenerations(- {- feature: "storyboard",- modelId: first ? (refs.length ? m.firstWithRefs : m.first) : m.next,- prompt: framePrompt(scene, i, { refs: frameRefs.length, chainFrom: m.chainFrom, style: r.style }),- inputs: frameRefs.length ? { images: frameRefs } : undefined,- params,- chainFrom: first ? undefined : m.chainFrom,- frame: { scene, index: i, of: scenes.length },- },- { batchId, dependsOn: previous },- );+ const request: GenerationRequest & { batchTitle?: string } = {+ feature: "storyboard",+ modelId: first ? (refs.length ? m.firstWithRefs : m.first) : m.next,+ prompt: framePrompt(scene, i, { refs: frameRefs.length, chainFrom: m.chainFrom, style: r.style }),+ inputs: frameRefs.length ? { images: frameRefs } : undefined,+ params,+ chainFrom: first ? undefined : m.chainFrom,+ frame: { scene, index: i, of: scenes.length },+ batchTitle,+ };+ const [g] = createGenerations(request, { batchId, dependsOn: previous });items.push(g);previous = g.id;});@@ -71,22 +73,23 @@ export function createStoryboardFilm(batchId: string, opts: { modelId?: string }const model = filmModel(frames[0].engine, opts.modelId);const flf = supportsOp(model, "flf2v");const filmBatch = `${batchId}-film`;+ // Boards made before the server stored a name fall back to the first scene.+ const batchTitle = (frames[0].request as { batchTitle?: string }).batchTitle?.trim() || frames[0].request.frame?.scene || "Storyboard film";const aspectRatio = frames[0].request.params?.aspectRatio;const n = frames.length;const clips = frames.map((f, i) => {const next = flf ? frames[i + 1] : undefined;const scene = f.request.frame?.scene ?? f.request.prompt ?? "";- return createGenerations(- {- feature: "storyboard-film",- modelId: model.id,- prompt: next ? `${scene}. The shot moves naturally toward the next moment: ${next.request.frame?.scene ?? ""}` : `${scene}. Natural, cinematic motion.`,- params: { aspectRatio, duration: model.defaults?.duration },- chain: next ? [{ slot: "images", position: "first" }, { slot: "endImage" }] : [{ slot: "images", position: "first" }],- step: { label: `Shot ${i + 1} of ${n}`, index: i, of: n },- },- { batchId: filmBatch, dependsOn: next ? [f.id, next.id] : f.id },- )[0];+ const request: GenerationRequest & { batchTitle?: string } = {+ feature: "storyboard-film",+ modelId: model.id,+ prompt: next ? `${scene}. The shot moves naturally toward the next moment: ${next.request.frame?.scene ?? ""}` : `${scene}. Natural, cinematic motion.`,+ params: { aspectRatio, duration: model.defaults?.duration },+ chain: next ? [{ slot: "images", position: "first" }, { slot: "endImage" }] : [{ slot: "images", position: "first" }],+ step: { label: `Shot ${i + 1} of ${n}`, index: i, of: n },+ batchTitle,+ };+ return createGenerations(request, { batchId: filmBatch, dependsOn: next ? [f.id, next.id] : f.id })[0];});const film = joinClips(clips.map((c) => c.id),@@ -94,7 +97,7 @@ export function createStoryboardFilm(batchId: string, opts: { modelId?: string }engine: model.engine,feature: "storyboard-film",batchId: filmBatch,- title: frames[0].request.frame?.scene ?? "Storyboard film",+ title: batchTitle,aspectRatio,resolution: model.defaults?.resolution,step: { label: `Film · ${n} shots`, index: n, of: n + 1 },diff --git a/tests/storyboard-name.test.ts b/tests/storyboard-name.test.tsnew file mode 100644index 00000000..9bc5713d--- /dev/null+++ b/tests/storyboard-name.test.ts@@ -0,0 +1,43 @@+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { afterAll, beforeAll, describe, expect, it } from "vitest";++const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-storyboard-name-"));+process.env.FUOBE_DATA_DIR = dir;+process.env.COMFYUI_URL = "http://127.0.0.1:9";++const { setSetting } = await import("@/server/settings");+const gens = await import("@/server/generations");+const { createStoryboard, createStoryboardFilm } = await import("@/server/storyboard");+const { boardTitle } = await import("@/lib/storyboard-board");++beforeAll(() => {+ setSetting("demoMode", "auto");+ // No prompt LLM: the story is split by the offline shot list.+ setSetting("enhanceProvider", "none");+});+afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));++const batchTitle = (id: string) => (gens.getGeneration(id)!.request as { batchTitle?: string }).batchTitle;++describe("storyboard name on the server (U14)", () => {+ it("stores the idea on every frame, so any browser titles the board with it", async () => {+ const idea = "a lighthouse keeper finds a glowing bottle and follows its map into the sea";+ const board = await createStoryboard({ engine: "open", story: idea, frames: 3 });+ expect(board.items).toHaveLength(3);+ for (const g of board.items) expect(batchTitle(g.id)).toBe(idea);+ // A fresh browser has nothing remembered: the stored name still wins over the first scene.+ const frames = board.items.map((g) => gens.getGeneration(g.id)!);+ expect(boardTitle(frames, null)).toBe("A lighthouse keeper finds a glowing bottle and follows its map into the sea");+ });++ it("names a hand-written board after its first scene, and its film after the board", async () => {+ const board = await createStoryboard({ engine: "open", scenes: ["A fox wakes in the snow", "It follows a trail", "The trail ends at a cabin"] });+ expect(batchTitle(board.items[2].id)).toBe("A fox wakes in the snow");+ const { items } = createStoryboardFilm(board.batchId);+ const [film, ...clips] = items;+ for (const c of clips) expect(batchTitle(c.id)).toBe("A fox wakes in the snow");+ expect(film.prompt ?? film.request.prompt).toBe("A fox wakes in the snow");+ });+});