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
Originals O2: the Look chip shows what runs, and a hand-off lands on its model
Claude3c23c921055e
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 0c70cb77..58ef73e4 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -13,6 +13,7 @@ import { estimateCost, planGeneration, routesFor } from "@/lib/catalog/plan";import type { Engine, GenerationRequest, MediaKind, ModelDef, Operation, Preset, VideoFormat } from "@/lib/catalog/types";import { dualEngine } from "@/lib/catalog/engines";import { locksByDefault } from "@/lib/catalog/palettes";+import { DEFAULT_LOOK, lookCard } from "@/lib/catalog/soul-cards";import { formatsOf } from "@/lib/av/formats";import { enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";import { applyMentions, type StudioElement } from "@/lib/catalog/elements";@@ -118,8 +119,11 @@ function buildRequest(promptSuffix?: string,refKind: MediaKind = "image",frames?: FramesContext,- /** A Fuobe Original (runs on both engines): the engine switched to. */- engine?: Engine,+ /**+ * The model's needs: a Fuobe Original (runs on both engines) names the engine switched to; a model that takes+ * looks (Fuobe Soul) takes the look's strength with its default look too (no presetId).+ */+ target: { engine?: Engine; looks?: boolean } = {},): GenerationRequest {const s = draft.slots;const refs = draft.refs.filter((x) => !!x?.ref).map((x) => x.ref);@@ -156,9 +160,9 @@ function buildRequest(},params,presetOptions: draft.presetOptions,- ...(draft.presetId && draft.presetStrength !== undefined && draft.presetStrength < 1 && { presetStrength: draft.presetStrength }),+ ...((draft.presetId || target.looks) && draft.presetStrength !== undefined && draft.presetStrength < 1 && { presetStrength: draft.presetStrength }),...(draft.presetId && draft.mix && { mix: draft.mix }),- ...(engine && { engine }),+ ...(target.engine && { engine: target.engine }),};}@@ -241,8 +245,21 @@ export function Composer({ docked }: { docked: boolean }) {const preset: Preset | undefined = draft.presetId && !takesLook ? catalog.getPreset(draft.presetId) : config.preset;const lockedModel = preset?.type === "app";const presetLoading = !!draft.presetId && !takesLook && !preset && !catalog.complete;- /** The engine a request names: only a model that runs on both (a Fuobe Original) needs it. */- const engineFor = (id: string) => (dualEngine(catalog.getModel(id)) ? engine : undefined);+ /** What the request names for its model: the engine (only a model that runs on both, a Fuobe Original), and whether it takes looks. */+ const targetFor = (id: string) => {+ const m = catalog.getModel(id);+ return { engine: dualEngine(m) ? engine : undefined, looks: !!m?.options.looks };+ };++ // A curated moodboard on a model that takes looks is a look: it moves to the Look chip, so the chip shows what+ // runs (a /moodboards link, or a pick in the Moodboard panel, would otherwise override the chip unseen).+ const curatedId = draft.signature?.moodboard?.kind === "curated" ? draft.signature.moodboard.id : undefined;+ useEffect(() => {+ const card = takesLook && curatedId ? lookCard(curatedId) : undefined;+ if (!card) return;+ setDraft((d) => ({ presetId: card.id === DEFAULT_LOOK ? undefined : card.id, signature: { ...d.signature, moodboard: undefined } }));+ toast(`${card.name} is a Fuobe Soul look: it's on the Look chip`);+ }, [takesLook, curatedId, setDraft]);// Presets handed over in the URL, a Mix, or a model outside this studio's slice: fetch the full catalog.const needsFull = presetLoading || (!!draft.mix && !catalog.getPreset(draft.mix.presetId)) || (catalog.ready && !model);@@ -255,7 +272,9 @@ export function Composer({ docked }: { docked: boolean }) {if (!model || model.engine === engine) return;const next = lockedModel ? (engine === "open" ? preset?.open?.modelId : preset?.cloud?.modelId) : config.defaultModels[engine];const m = next ? catalog.getModel(next) : undefined;- if (m) setDraft((d) => ({ modelId: m.id, params: { ...m.defaults, numOutputs: d.params.numOutputs, enhancePrompt: d.params.enhancePrompt }, ...lookCleared(model, m) }));+ // Only the model this effect saw: a hand-off applied in the same commit (?model=, a layout effect) already+ // replaced it, and swapping it for the engine's default would undo the link (it landed on Z-Image Turbo).+ if (m) setDraft((d) => (d.modelId !== model.id ? {} : { modelId: m.id, params: { ...m.defaults, numOutputs: d.params.numOutputs, enhancePrompt: d.params.enhancePrompt }, ...lookCleared(model, m) }));}, [engine, model, lockedModel, preset, config.defaultModels, setDraft, catalog]);// Single-purpose studios (Extend, Reframe, Edit video…) pin their operation.@@ -296,7 +315,7 @@ export function Composer({ docked }: { docked: boolean }) {// A picked palette / moodboard routes the request (and can move it to another model) before anything else.const signature = useSignature(!!config.signature, draft.signature);const prepare = (d: typeof draft) => {- const signed = signature.apply(buildRequest(config.feature, d, studioOp, config.promptSuffix, config.multiRef?.kind, framesCtx, engineFor(d.modelId)));+ const signed = signature.apply(buildRequest(config.feature, d, studioOp, config.promptSuffix, config.multiRef?.kind, framesCtx, targetFor(d.modelId)));// Planned with the signature's sentences in the prompt (as the server runs it); sent with them apart.const raw = signed.worded;const m = catalog.getModel(raw.modelId) ?? model;@@ -385,7 +404,7 @@ export function Composer({ docked }: { docked: boolean }) {setRecent((r) => pushRecent(r, draft.modelId));// The server resolves @mentions and drawings itself; only pin the operation when there are none.// No "Queued" toast: the new card (and the "1 generating ↑" pill when it's off-screen) says it.- const sent = signature.apply(buildRequest(config.feature, draft, resolvesOnServer ? studioOp : op, config.promptSuffix, config.multiRef?.kind, framesCtx, engineFor(draft.modelId)));+ const sent = signature.apply(buildRequest(config.feature, draft, resolvesOnServer ? studioOp : op, config.promptSuffix, config.multiRef?.kind, framesCtx, targetFor(draft.modelId)));// Open palette lock: the images are recoloured to the palette by a chained step (POST /api/palettes/lock).if (sent.lock) return signature.lock.mutate({ request: sent.request, colors: sent.lock.colors }, { onError: (e) => toast.error((e as Error).message) });create.mutate(sent.request, {@@ -631,10 +650,14 @@ export function Composer({ docked }: { docked: boolean }) {value={draft.presetId}strength={draft.presetStrength ?? 1}onChange={(id, look) => {- // A lettering look runs best on Fuobe Soul HD: move there when it's in this studio.+ // A lettering look runs best on Fuobe Soul HD: move there when it's in this studio and can run what this+ // run does (Soul HD makes new pictures only: with a picture attached, Fuobe Soul edits it with the look's words).const hd = look?.hd && model?.id !== "fuobe-soul-hd" ? catalog.getModel("fuobe-soul-hd") : undefined;- if (hd) toast(`${look!.name} runs on Fuobe Soul HD (cleaner lettering)`);- setDraft((d) => ({ presetId: id, presetStrength: id ? d.presetStrength : undefined, ...(hd && { modelId: hd.id }) }));+ const fits = !!hd && routesFor(hd, effectiveOp ?? "t2i").length > 0;+ if (hd && fits) toast(`${look!.name} runs on Fuobe Soul HD (cleaner lettering)`);+ else if (hd) toast(`${look!.name} is made for Fuobe Soul HD, which doesn't edit pictures: here it uses its words`);+ // The strength stays as it was set (it scales whichever look runs, the General look too).+ setDraft({ presetId: id, ...(hd && fits && { modelId: hd.id }) });}}onStrength={(v) => setDraft({ presetStrength: v })}/>diff --git a/src/components/studio/look-chip.tsx b/src/components/studio/look-chip.tsxindex cbdeae30..ab9018a9 100644--- a/src/components/studio/look-chip.tsx+++ b/src/components/studio/look-chip.tsx@@ -8,6 +8,7 @@ import { curatedLook } from "@/components/moodboards/logic";import { DEFAULT_LOOK, lookCard, lookSet, type SoulLookCard } from "@/lib/catalog/soul-cards";import { cn } from "@/lib/utils";import { Chip, ClearableChip } from "./chip";+import { radioKeys, radioTab } from "./radio-keys";import { ResponsivePanel } from "./responsive-panel";/**@@ -60,18 +61,20 @@ export default function LookChip({<Chip icon={picked ? undefined : Sparkles} active={!!value} aria-label={`Look: ${picked?.name ?? "General"}`}>{picked && <CuratedCover m={{ name: "", ...curatedLook(picked.id) }} className="size-4 rounded-full" />}<span className="max-w-32 truncate">{picked?.name ?? "Look"}</span>- {value && strength < 1 && <span className="text-muted-foreground tabular-nums">{pct(strength)}</span>}+ {strength < 1 && <span className="text-muted-foreground tabular-nums">{pct(strength)}</span>}</Chip>}><div className="mb-2 flex flex-wrap items-center gap-2">- <div role="tablist" aria-label="Soul version" className="inline-flex shrink-0 rounded-full bg-muted p-0.5">+ {/* Filters of the grid below (not tabs with panels): a radio group each, arrow keys move and pick. */}+ <div role="radiogroup" aria-label="Soul version" onKeyDown={radioKeys} className="inline-flex shrink-0 rounded-full bg-muted p-0.5">{FAMILIES.map(([f, label]) => (<buttonkey={f}type="button"- role="tab"- aria-selected={family === f}+ role="radio"+ aria-checked={family === f}+ tabIndex={radioTab(family === f)}onClick={() => {setFamily(f);setTab("All presets");@@ -97,13 +100,14 @@ export default function LookChip({</label></div>{!q && (- <div role="tablist" aria-label="Look categories" className="scrollbar-none -mx-0.5 mb-2 flex gap-1 overflow-x-auto px-0.5">+ <div role="radiogroup" aria-label="Look categories" onKeyDown={radioKeys} className="scrollbar-none -mx-0.5 mb-2 flex gap-1 overflow-x-auto px-0.5">{tabs.map((t) => (<buttonkey={t}type="button"- role="tab"- aria-selected={tab === t}+ role="radio"+ aria-checked={tab === t}+ tabIndex={radioTab(tab === t)}onClick={() => setTab(t)}className={cn("h-7 shrink-0 rounded-full px-2.5 text-[12px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50",@@ -132,6 +136,7 @@ export default function LookChip({<CuratedCover m={{ name: "", ...curatedLook(l.id) }} className="size-full transition-transform duration-300 group-hover:scale-105" />{l.civitai && (<span+ aria-hiddenclassName="absolute right-1 bottom-1 grid size-4 place-items-center rounded-full bg-black/45 text-white"title="Its LoRA downloads from civitai: add your free civitai key in Settings → LoRAs">@@ -140,6 +145,7 @@ export default function LookChip({)}</span><span className="truncate px-0.5 text-[12px] font-medium">{l.name}</span>+ {l.civitai && <span className="sr-only">: its LoRA downloads from civitai and needs your free civitai key</span>}</button>))}{!items.length && <p className="col-span-full py-8 text-center text-[13px] text-muted-foreground">No looks match “{q}”</p>}diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsxindex 4985d3d3..eccd4f2e 100644--- a/src/components/studio/studio-page.tsx+++ b/src/components/studio/studio-page.tsx@@ -10,7 +10,7 @@ import { toast } from "sonner";import { SidebarTrigger } from "@/components/ui/sidebar";import type { Generation, MediaKind, ModelDef, Preset } from "@/lib/catalog/types";import { useEngine, useGenerations } from "@/lib/api";-import { claimStartToken, handoffKey, mergeHandoff, promptShown, START_PARAM, withoutStart } from "@/lib/composer";+import { claimStartToken, followEngineDefault, handoffKey, mergeHandoff, promptShown, START_PARAM, withoutStart } from "@/lib/composer";import { positionsFrom } from "@/lib/catalog/keyframes";import { reuseSignature, withSignatureWords } from "@/lib/catalog/palettes";import { matchSpokenLanguage } from "@/lib/speech-languages";@@ -395,6 +395,7 @@ function HandoffSync({start,build,adopt,+ follow,ready,onNavigate,onStart,@@ -403,6 +404,8 @@ function HandoffSync({start: Draft;build: React.RefObject<(key: string) => Draft>;adopt: React.RefObject<(key: string) => void>;+ /** The base after the composer's own engine swap (followEngineDefault). */+ follow: React.RefObject<(base: Draft, current: Draft) => Draft>;ready: boolean;onNavigate: (key: string) => void;onStart: () => void;@@ -420,7 +423,7 @@ function HandoffSync({if (url.key !== a.key || ready !== a.ready) {const next = build.current(url.key);const base = a.base;- setDraft((d) => mergeHandoff(base, d, next));+ setDraft((d) => mergeHandoff(follow.current(base, d), d, next));adopt.current(url.key);applied.current = { key: url.key, ready, base: next, seen: true };}@@ -429,7 +432,7 @@ function HandoffSync({if (claimStartToken(url.start)) onStart();window.history.replaceState(null, "", withoutStart(window.location.href));}- }, [url, ready, build, adopt, setDraft, onNavigate, onStart]);+ }, [url, ready, build, adopt, follow, setDraft, onNavigate, onStart]);return (<Suspense fallback={null}><UrlParams onChange={onParams} />@@ -471,11 +474,16 @@ function StudioDraft({ config, header, tabs, initialRefs, initialPrompt }: Draftconst m = id ? catalog.getModel(id) : undefined;if (m && m.engine !== engine) setEngine(m.engine);};+ // The composer swaps an untouched default for the engine's own when the engine is read after hydration: a+ // hand-off still applies over that swap.+ const follow = (base: Draft, current: Draft) => followEngineDefault(base, current, config.defaultModels, engine);const buildRef = useRef(build);const adoptRef = useRef(adopt);+ const followRef = useRef(follow);useLayoutEffect(() => {buildRef.current = build;adoptRef.current = adopt;+ followRef.current = follow;});// The draft the composer starts from: the defaults (the URL is unknown in the static shell), or// the hand-off params of a client navigation to new ones (a new epoch remounts the provider).@@ -488,7 +496,7 @@ function StudioDraft({ config, header, tabs, initialRefs, initialPrompt }: Draftreturn (<ComposerBridgeCtx.Provider value={bridge}><StudioProvider key={start.epoch} config={config} initial={initial}>- <StudioSession header={header} tabs={tabs} sync={{ startKey: start.key, start: initial, build: buildRef, adopt: adoptRef, ready: catalog.ready, onNavigate }} />+ <StudioSession header={header} tabs={tabs} sync={{ startKey: start.key, start: initial, build: buildRef, adopt: adoptRef, follow: followRef, ready: catalog.ready, onNavigate }} /></StudioProvider></ComposerBridgeCtx.Provider>);diff --git a/src/lib/composer.ts b/src/lib/composer.tsindex 2808cfc2..2c7fc77c 100644--- a/src/lib/composer.ts+++ b/src/lib/composer.ts@@ -672,6 +672,18 @@ export interface DraftShape {const same = (a: unknown, b: unknown) => a === b || JSON.stringify(a ?? null) === JSON.stringify(b ?? null);const sameAttachment = (a: Attachment | null | undefined, b: Attachment | null | undefined) => (a ?? null) === (b ?? null) || (!!a && !!b && a.id === b.id && a.ref === b.ref);+/**+ * The draft a hand-off compares with, after the page's own model swap: the engine is read after hydration (or+ * switched while the page loads), and the composer swaps an untouched draft's studio default for that engine's+ * default. That swap isn't the person's pick, so the base follows it and the hand-off's model (?model=) still+ * applies; without this, a link opened on the open engine kept the open default (Z-Image Turbo).+ */+export function followEngineDefault<D extends DraftShape>(base: D, current: D, defaults: Partial<Record<Engine, string>>, engine: Engine): D {+ const own = Object.values(defaults).filter(Boolean);+ if (current.modelId === base.modelId || !own.includes(base.modelId) || current.modelId !== defaults[engine]) return base;+ return { ...base, modelId: current.modelId, params: current.params };+}+/*** Apply a draft computed from hand-off params (`next`) to the live draft (`current`) without* undoing what the person already did: a field still equal to the draft the composer started