Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Originals O13: the Storyboard picks a Fuobe Soul look, shows the board's price, and finishes each frame in the look

Claude66402da7f32d
diff --git a/src/app/(studio)/storyboard/page.tsx b/src/app/(studio)/storyboard/page.tsx
index ad6a5955..42c70bc5 100644
--- a/src/app/(studio)/storyboard/page.tsx
+++ b/src/app/(studio)/storyboard/page.tsx
@@ -1,7 +1,7 @@
import type { Metadata } from "next";
import { StoryboardView } from "@/components/storyboard-view";
import { getModel } from "@/lib/catalog";
-import { STORYBOARD_MODELS } from "@/lib/catalog/storyboard";
+import { STORYBOARD_LOOK_MODEL, STORYBOARD_MODELS } from "@/lib/catalog/storyboard";
export const metadata: Metadata = { title: "Storyboard" };
@@ -9,6 +9,7 @@ export const metadata: Metadata = { title: "Storyboard" };
const MODEL_NAMES = Object.fromEntries(
Object.values(STORYBOARD_MODELS)
.flatMap((m) => [m.first, m.firstWithRefs, m.next])
+ .concat(STORYBOARD_LOOK_MODEL)
.map((id) => [id, getModel(id)?.name ?? id]),
);
diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsx
index 203edb55..0382eb59 100644
--- a/src/components/storyboard-view.tsx
+++ b/src/components/storyboard-view.tsx
@@ -1,7 +1,8 @@
"use client";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { ArrowUp, Clapperboard, Film, ImagePlus, Loader2, Minus, Plus, Sparkles, Trash2, Wand2, X } from "lucide-react";
+import dynamic from "next/dynamic";
import Link from "next/link";
import { useMemo, useState, useSyncExternalStore } from "react";
import { nanoid } from "nanoid";
@@ -10,18 +11,34 @@ import { Button } from "@/components/ui/button";
import { SidebarTrigger } from "@/components/ui/sidebar";
import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
+import { useDebounced } from "@/components/faceless/hooks";
+import { costText } from "@/components/shorts/ui";
import { EngineSwitch } from "@/components/studio/engine-switch";
+import { useSoulFinish } from "@/components/studio/soul-finish";
import { FailedTile, MediaThumb, PendingTile, tileRatio } from "@/components/studio/feed";
import { fileToSlot, MediaSlot, type SlotValue } from "@/components/studio/media-slot";
import { Viewer } from "@/components/studio/viewer";
import { useCreateGeneration, useEngine, useGenerationActions, useGenerations } from "@/lib/api";
-import { MAX_FRAMES, STORYBOARD_MODELS } from "@/lib/catalog/storyboard";
+import { MAX_FRAMES, STORYBOARD_ASPECTS, STORYBOARD_LOOK_MODEL, STORYBOARD_MODELS } from "@/lib/catalog/storyboard";
+import { lookCard } from "@/lib/catalog/soul-cards";
import type { Engine, Generation } from "@/lib/catalog/types";
import { timeAgo } from "@/lib/format";
import { BOARD_TITLES_KEY, boardTitle, filmReady, rememberTitle } from "@/lib/storyboard-board";
import { cn } from "@/lib/utils";
-const ASPECTS = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
+const ASPECTS: readonly string[] = STORYBOARD_ASPECTS;
+
+/** Fuobe Soul's look picker, in its own chunk (the board works without it). */
+const LookChip = dynamic(() => import("@/components/studio/look-chip"), {
+ loading: () => <span aria-hidden className="h-8 w-28 shrink-0 animate-pulse rounded-full bg-secondary" />,
+});
+
+interface BoardEstimate {
+ costUsd: number | null;
+ demo: boolean;
+ frames: number;
+ models: string[];
+}
/* The idea each board was made from, remembered in this browser (the server keeps only the scenes). */
const titleListeners = new Set<() => void>();
@@ -235,9 +252,13 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
const [style, setStyle] = useState("");
const [aspect, setAspect] = useState("16:9");
const [refs, setRefs] = useState<SlotValue[]>([]);
+ const [look, setLook] = useState<string | undefined>();
+ const [lookStrength, setLookStrength] = useState(1);
const [open, setOpen] = useState<Generation | null>(null);
const feed = useGenerations({ features: ["storyboard", "storyboard-film"], limit: 240 });
const titles = useBoardTitles();
+ // A board with a look: each frame gets the look's grade and overlay here, once it's made.
+ useSoulFinish(feed.data ?? []);
const films = useMemo(() => {
const by = new Map<string, Generation[]>();
@@ -260,18 +281,37 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
const pos = open ? flat.findIndex((g) => g.id === open.id) : -1;
const m = STORYBOARD_MODELS[engine as Engine];
+ const lookName = look ? lookCard(look)?.name : undefined;
+ const filled = scenes.filter((s) => s.trim());
+ const boardBody = {
+ engine,
+ ...(mode === "auto" ? { story, frames: count } : { scenes: filled }),
+ references: refs.filter((r) => r.ref && !r.uploading).map((r) => r.ref),
+ style: style || undefined,
+ ...(look && { look, lookStrength }),
+ aspectRatio: aspect,
+ };
+ // The price before it runs: the words don't change it, so typing doesn't ask again.
+ const priceKey = useDebounced(JSON.stringify({ ...boardBody, story: undefined, scenes: mode === "auto" ? undefined : filled.map(() => "·") }), 300);
+ const estimate = useQuery({
+ queryKey: ["storyboard-estimate", priceKey],
+ queryFn: async () => {
+ const res = await fetch("/api/storyboards/estimate", { method: "POST", headers: { "Content-Type": "application/json" }, body: priceKey });
+ const body = await res.json();
+ if (!res.ok) throw new Error(body.error);
+ return body as BoardEstimate;
+ },
+ placeholderData: keepPreviousData,
+ retry: false,
+ staleTime: 30_000,
+ });
+ const est = estimate.data && !estimate.isError ? estimate.data : undefined;
const submit = useMutation({
mutationFn: async () => {
const res = await fetch("/api/storyboards", {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- engine,
- ...(mode === "auto" ? { story, frames: count } : { scenes: scenes.filter((s) => s.trim()) }),
- references: refs.filter((r) => r.ref).map((r) => r.ref),
- style: style || undefined,
- aspectRatio: aspect,
- }),
+ body: JSON.stringify({ ...boardBody, references: refs.filter((r) => r.ref).map((r) => r.ref) }),
});
const body = await res.json();
if (!res.ok) throw new Error(body.error);
@@ -313,7 +353,11 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
<h2 className="font-heading text-display text-balance">Tell it frame by frame</h2>
<p className="mt-2 text-[13px] text-muted-foreground">
Up to {MAX_FRAMES} consistent frames — each one is made from the previous frame, so faces, wardrobe and light carry through.
- {modelNames[m.next] ? ` Runs on ${modelNames[m.next]}.` : ""}
+ {lookName && !refs.length
+ ? ` Frame 1 on ${modelNames[STORYBOARD_LOOK_MODEL] ?? "Fuobe Soul"} in the ${lookName} look, then ${modelNames[m.next] ?? m.next}.`
+ : modelNames[m.next]
+ ? ` Runs on ${modelNames[m.next]}.`
+ : ""}
</p>
<div className="mt-6 rounded-[20px] border bg-background p-3 text-left shadow-soft focus-within:border-primary focus-within:ring-4 focus-within:ring-brand-faint sm:rounded-composer">
<div role="radiogroup" aria-label="How to write it" className="mb-2 flex items-center gap-1 rounded-full bg-muted p-0.5 text-[13px] font-medium sm:w-fit">
@@ -406,14 +450,28 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
</button>
</div>
)}
+ <LookChip value={look} strength={lookStrength} onChange={(id) => setLook(id)} onStrength={setLookStrength} none="No look" />
<RatioPill value={aspect} onChange={setAspect} />
- <Button size="icon" className="ml-auto size-10 shrink-0 rounded-full" disabled={!ready || submit.isPending} onClick={() => submit.mutate()} aria-label="Generate storyboard">
- {submit.isPending ? <Loader2 className="animate-spin" /> : <ArrowUp />}
- </Button>
+ <div className="ml-auto flex shrink-0 items-center gap-2">
+ <span className="text-right text-[12px] leading-tight tabular-nums text-muted-foreground" aria-live="polite">
+ {estimate.isError ? (
+ <span className="text-destructive">{(estimate.error as Error).message}</span>
+ ) : (
+ <>
+ <span className="block font-semibold text-foreground">{costText(est, engine as Engine)}</span>
+ {est && `${est.frames} frame${est.frames === 1 ? "" : "s"}`}
+ </>
+ )}
+ </span>
+ <Button size="icon" className="size-10 shrink-0 rounded-full" disabled={!ready || submit.isPending || estimate.isError} onClick={() => submit.mutate()} aria-label="Generate storyboard">
+ {submit.isPending ? <Loader2 className="animate-spin" /> : <ArrowUp />}
+ </Button>
+ </div>
</div>
<p className="mt-2 flex items-start gap-1.5 text-[11px] text-muted-foreground">
<Sparkles className="mt-px size-3 shrink-0" />
{mode === "auto" ? "Your story is split into frames by the prompt LLM (Settings → Prompt enhancement), or a shot list when none is set." : "One prompt per frame. References keep the cast consistent."}
+ {lookName && ` Every frame gets the ${lookName} look's grade${aspect === "21:9" ? ", made at 16:9 and cropped to 21:9" : ""}.`}
</p>
</div>
</div>
diff --git a/src/components/studio/look-chip.tsx b/src/components/studio/look-chip.tsx
index ab9018a9..885270fa 100644
--- a/src/components/studio/look-chip.tsx
+++ b/src/components/studio/look-chip.tsx
@@ -29,15 +29,18 @@ export default function LookChip({
strength,
onChange,
onStrength,
+ none,
}: {
- /** The look's id (Soul's default look when unset). */
+ /** The look's id (Soul's default look when unset, or no look when `none` is set). */
value?: string;
strength: number;
onChange: (id: string | undefined, look?: SoulLookCard) => void;
onStrength: (v: number) => void;
+ /** Unset means no look at all (a storyboard without one), shown as this label; picking General then sends its id. */
+ none?: string;
}) {
const [open, setOpen] = useState(false);
- const picked = lookCard(value ?? DEFAULT_LOOK);
+ const picked = value ? lookCard(value) : none ? undefined : lookCard(DEFAULT_LOOK);
const [family, setFamily] = useState<"v1" | "v2">(picked?.family ?? "v2");
const [tab, setTab] = useState("All presets");
const [q, setQ] = useState("");
@@ -50,7 +53,7 @@ export default function LookChip({
return pool.filter((l) => (words ? `${l.name} ${l.description}`.toLowerCase().includes(words) : tab === "All presets" || l.categories.includes(tab)));
}, [q, set, tab]);
return (
- <ClearableChip active={!!value} onClear={() => onChange(undefined)} clearLabel="Back to the General look">
+ <ClearableChip active={!!value} onClear={() => onChange(undefined)} clearLabel={none ? `Back to ${none.toLowerCase()}` : "Back to the General look"}>
<ResponsivePanel
open={open}
onOpenChange={setOpen}
@@ -58,9 +61,9 @@ export default function LookChip({
description="Soul's looks on open weights: words, LoRAs and a grade"
className="w-[min(92vw,480px)] p-2"
trigger={
- <Chip icon={picked ? undefined : Sparkles} active={!!value} aria-label={`Look: ${picked?.name ?? "General"}`}>
+ <Chip icon={picked ? undefined : Sparkles} active={!!value} aria-label={`Look: ${picked?.name ?? none ?? "General"}`}>
{picked && <CuratedCover m={{ name: "", ...curatedLook(picked.id) }} className="size-4 rounded-full" />}
- <span className="max-w-32 truncate">{picked?.name ?? "Look"}</span>
+ <span className="max-w-32 truncate">{picked?.name ?? none ?? "Look"}</span>
{strength < 1 && <span className="text-muted-foreground tabular-nums">{pct(strength)}</span>}
</Chip>
}
@@ -127,7 +130,7 @@ export default function LookChip({
aria-pressed={picked?.id === l.id}
title={l.description}
onClick={() => {
- onChange(l.id === DEFAULT_LOOK ? undefined : l.id, l);
+ onChange(l.id === DEFAULT_LOOK && !none ? undefined : l.id, l);
setOpen(false);
}}
className={cn("group flex min-w-0 flex-col gap-1 rounded-lg p-1 text-left ring-primary transition hover:bg-accent", picked?.id === l.id && "ring-2")}