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 O4: a motion runs on Fuobe DoP from the composer, colour grades and relights as steps

Claude52d822147800
diff --git a/src/app/(studio)/effects/page.tsx b/src/app/(studio)/effects/page.tsx
index cbe163ca..dbdc0f94 100644
--- a/src/app/(studio)/effects/page.tsx
+++ b/src/app/(studio)/effects/page.tsx
@@ -11,7 +11,7 @@ export default function Page() {
<PageShell>
<PageHeader
title="Effects"
- description="Explosions, transformations and viral VFX from a single photo. Open-source versions use Wan effect LoRAs where available."
+ description="Explosions, transformations and viral VFX from a single photo. Fuobe DoP runs each with its effect LoRA where one is cleared, free on your GPU or hosted in the cloud; colour looks are graded in your browser."
/>
<PresetGallery presets={EFFECTS.map(toPresetCard)} href="/video?preset={id}" noun="effects" />
</PageShell>
diff --git a/src/app/(studio)/motions/page.tsx b/src/app/(studio)/motions/page.tsx
index 28b07e82..271b9bd3 100644
--- a/src/app/(studio)/motions/page.tsx
+++ b/src/app/(studio)/motions/page.tsx
@@ -11,7 +11,7 @@ export default function Page() {
<PageShell>
<PageHeader
title="Camera motions"
- description="Director-grade camera moves for any image. Pick a move, drop in a start frame, and it runs on Kling, Veo, Seedance… or Wan 2.2 on your own GPU."
+ description="Director-grade camera moves for any image. Pick a move, drop in a start frame: Fuobe DoP runs it with its camera LoRA, free on your GPU or hosted in the cloud. Any other video model takes the move's words."
/>
<PresetGallery presets={MOTIONS.map(toPresetCard)} href="/video?preset={id}" noun="moves" />
</PageShell>
diff --git a/src/components/color-grade-view.tsx b/src/components/color-grade-view.tsx
index eab16ae7..6322f76d 100644
--- a/src/components/color-grade-view.tsx
+++ b/src/components/color-grade-view.tsx
@@ -134,8 +134,10 @@ function Grader() {
const initial = sp.get("video") ? { url: sp.get("video")!, kind: "video" as const } : sp.get("image") ? { url: sp.get("image")!, kind: "image" as const } : null;
const [input, setInput] = useState<{ url: string; kind: "image" | "video" } | null>(initial);
const [source, setSource] = useState<Source | null>(null);
- const [grade, setGrade] = useState<Grade>(NEUTRAL);
- const [preset, setPreset] = useState<string | undefined>();
+ // A clip handed over with its grade (?preset=, a Fuobe DoP colour-grade effect) opens with that grade picked.
+ const handed = PRESETS.find((p) => p.id === sp.get("preset"));
+ const [grade, setGrade] = useState<Grade>(() => (handed ? applyPreset(handed) : NEUTRAL));
+ const [preset, setPreset] = useState<string | undefined>(handed?.id);
const [holding, setHolding] = useState(false);
const [saving, setSaving] = useState<null | "image" | number>(null);
const [saved, setSaved] = useState<string | null>(null);
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 58ef73e4..7f213ae1 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -51,6 +51,8 @@ import {
needsMask,
onImageChange,
PLACEHOLDER,
+ presetModel,
+ prestepCost,
pushRecent,
settingsShape,
showsPrompt,
@@ -267,16 +269,30 @@ export function Composer({ docked }: { docked: boolean }) {
if (needsFull) void loadFullCatalog();
}, [needsFull]);
- // Keep the selected model in sync with the engine switch.
+ // Keep the selected model in sync with the engine switch. A camera motion or effect keeps its Original (Fuobe DoP),
+ // moving to the model its move names on this engine (Jib Up: Fuobe DoP on the GPU, Fuobe DoP · LTX in the cloud).
useEffect(() => {
- if (!model || model.engine === engine) return;
- const next = lockedModel ? (engine === "open" ? preset?.open?.modelId : preset?.cloud?.modelId) : config.defaultModels[engine];
+ if (!model) return;
+ const want = presetModel(preset, engine);
+ const follows = !!want && want !== model.id && model.id === presetModel(preset, engine === "open" ? "cloud" : "open");
+ if (model.engine === engine && !follows) return;
+ const next = lockedModel ? (engine === "open" ? preset?.open?.modelId : preset?.cloud?.modelId) : (want ?? config.defaultModels[engine]);
const m = next ? catalog.getModel(next) : undefined;
// 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]);
+ // A camera motion or effect runs on its Original on this engine (Fuobe DoP): picking one moves the composer there.
+ // Another video model can be picked after it; it takes the move's words.
+ const pickPreset = (id?: string) => {
+ if (!id) return setDraft({ presetId: undefined, mix: undefined, presetStrength: undefined });
+ const want = presetModel(catalog.getPreset(id), engine);
+ const m = want && want !== model?.id ? catalog.getModel(want) : undefined;
+ if (!m) return setDraft({ presetId: id });
+ setDraft((d) => ({ presetId: id, modelId: m.id, params: { ...m.defaults, numOutputs: d.params.numOutputs, enhancePrompt: d.params.enhancePrompt, seed: d.params.seed }, ...lookCleared(model, m) }));
+ };
+
// Single-purpose studios (Extend, Reframe, Edit video…) pin their operation.
const studioOp = config.ops.length === 1 && !preset ? config.ops[0] : undefined;
const opts = model?.options ?? {};
@@ -362,6 +378,8 @@ export function Composer({ docked }: { docked: boolean }) {
op = plan.op;
// A run with LoRAs (a Soul look) goes to the route's LoRA endpoint, which has its own price.
cost = estimateCost(plan.model, plan.params, plan.jobs, plan.op, plan.loras.length > 0 && routesFor(plan.model, plan.op).some((r) => !!r.loraEndpoint));
+ // A relight effect relights the start frame first (free on the GPU, about $0.04 in the cloud).
+ if (cost !== null) cost += prestepCost(preset, plan.model.id, engine);
} catch (e) {
planError = (e as Error).message;
}
@@ -629,7 +647,7 @@ export function Composer({ docked }: { docked: boolean }) {
presetId={draft.presetId}
strength={draft.presetStrength ?? 1}
mix={draft.mix}
- onPreset={(id) => setDraft(id ? { presetId: id } : { presetId: undefined, mix: undefined, presetStrength: undefined })}
+ onPreset={pickPreset}
onMix={(patch) => setDraft(patch)}
/>
)}
diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsx
index eccd4f2e..9b5a1ef7 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, followEngineDefault, handoffKey, mergeHandoff, promptShown, START_PARAM, withoutStart } from "@/lib/composer";
+import { claimStartToken, followEngineDefault, handoffKey, mergeHandoff, presetModel, 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";
@@ -46,9 +46,12 @@ function initialDraft(
const presetRoute = preset
? ([preset.cloud, preset.open].find((r) => !!requested && r?.modelId === requested) ?? (engine === "open" ? preset.open : preset.cloud) ?? preset.cloud ?? preset.open)
: null;
+ // A camera motion or effect starts on its Original (Fuobe DoP) when the studio has it.
+ const presetOwn = presetModel(preset, engine);
const modelId =
(requested && lookup.getModel(requested)?.id) ||
(preset?.type === "app" ? presetRoute?.modelId : undefined) ||
+ (presetOwn && lookup.getModel(presetOwn)?.id) ||
config.defaultModels[engine] ||
config.defaultModels.cloud ||
// Open-only tools (Match colors) keep their open model under the Cloud switch, like cloud-only ones do under Open.
diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts
index 6fb98bb4..819ae2ef 100644
--- a/src/lib/catalog/index.ts
+++ b/src/lib/catalog/index.ts
@@ -4,6 +4,7 @@ import { MODELS } from "./models";
import { LLM_MODELS } from "./llm-models";
import { dopPreset, presetLoras } from "./dop";
import { runsOn } from "./engines";
+import { estimateCost } from "./plan";
import type { Engine, MediaKind, ModelDef, Operation, Preset } from "./types";
MODELS.push(...LLM_MODELS.filter((m) => !MODELS.some((x) => x.id === m.id))); // text steps (translate, write) on the configured LLM; once per hot reload
@@ -26,6 +27,16 @@ function withOssLoras(p: Preset): Preset {
};
}
+/** A relight effect's step before the clip, priced on its model (a 1-megapixel picture; free on the user's GPU). */
+function withPrestepPrice(p: Preset): Preset {
+ if (!p.prestep) return p;
+ const price = (s: NonNullable<Preset["prestep"]>["open"]) => {
+ const m = modelIndex.get(s.modelId);
+ return m ? (estimateCost(m, { aspectRatio: "1:1", resolution: "1K", numOutputs: 1 }, 1, s.op, !!s.loras?.length) ?? undefined) : undefined;
+ };
+ return { ...p, prestep: { open: { ...p.prestep.open, usd: 0 }, cloud: { ...p.prestep.cloud, usd: price(p.prestep.cloud) } } };
+}
+
/** Open-source routes that need a dedicated workflow rather than an edit prompt. */
const APP_OPEN_OVERRIDES: Record<string, Preset["open"]> = {
"app-face-swap": { modelId: "oss-reactor", op: "face-swap" },
@@ -49,7 +60,7 @@ export const APPS: Preset[] = RAW_APPS.map((a) =>
APP_OPEN_OVERRIDES[a.id] ? { ...a, open: APP_OPEN_OVERRIDES[a.id], parity: a.parity ?? APP_OPEN_PARITY[a.id] } : a,
).map(withOssLoras);
export const MOTIONS: Preset[] = RAW_MOTIONS.map(dopPreset);
-export const EFFECTS: Preset[] = RAW_EFFECTS.map(dopPreset);
+export const EFFECTS: Preset[] = RAW_EFFECTS.map(dopPreset).map(withPrestepPrice);
export const PRESETS: Preset[] = [...APPS, ...MOTIONS, ...EFFECTS];
const presetIndex = new Map(PRESETS.map((p) => [p.id, p]));
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index c7574c10..5c7e7507 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -1521,6 +1521,8 @@ const originals: ModelDef[] = [
// A pose Wan 2.2 Fun Camera makes natively (params.extra.cameraMotion) runs on wan22-fun-camera-14b instead.
comfy("i2v", "wan22-i2v-14b", "Wan 2.2 14B with the motion's LoRAs on their experts, or Fun Camera's pose"),
comfy("flf2v", "wan22-flf2v-14b", "Wan 2.2 14B start and end frame with the effect's LoRAs"),
+ // Frames mode: one start/end-frame clip per pair of frames, the motion's LoRAs on each, then joined.
+ KEYFRAME_FILM,
],
tagline: "Camera motions and effects with their LoRAs on Wan 2.2 · free on your GPU (24 GB), or hosted on fal",
options: DOP_OPTIONS,
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index 93de7b18..5c763f58 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -1012,8 +1012,17 @@ export interface Preset {
/** A step whose picture becomes a preset's start frame (Fuobe DoP relights the still, then animates it). */
export interface PresetPrestep {
- open: { modelId: string; op: Operation; prompt: string; loras?: LoraRef[] };
- cloud: { modelId: string; op: Operation; prompt: string; loras?: LoraRef[] };
+ open: PrestepRoute;
+ cloud: PrestepRoute;
+}
+
+export interface PrestepRoute {
+ modelId: string;
+ op: Operation;
+ prompt: string;
+ loras?: LoraRef[];
+ /** What the step costs (a 1-megapixel picture), added to the clip's price before the run; 0 on the user's GPU. */
+ usd?: number;
}
/** Route endpoint for models without an extend API: last frame → image-to-video → join (src/server/chains.ts). */
diff --git a/src/lib/composer.ts b/src/lib/composer.ts
index 2c7fc77c..932e269d 100644
--- a/src/lib/composer.ts
+++ b/src/lib/composer.ts
@@ -678,6 +678,24 @@ const sameAttachment = (a: Attachment | null | undefined, b: Attachment | null |
* 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).
*/
+/**
+ * The model a camera motion or effect runs on by default on an engine (Fuobe DoP, or the route its move names: a
+ * camera LoRA in the cloud runs on Fuobe DoP · LTX). Undefined for apps (their model is pinned) and without a preset.
+ */
+export function presetModel(preset: Pick<Preset, "type" | "open" | "cloud"> | undefined, engine: Engine): string | undefined {
+ if (!preset || (preset.type !== "motion" && preset.type !== "effect")) return undefined;
+ return (engine === "open" ? preset.open : preset.cloud)?.modelId;
+}
+
+/**
+ * What a step before the clip adds to its price (Fuobe DoP relights a start frame first), when the run is on the
+ * preset's own model: a partner model runs the effect's words alone.
+ */
+export function prestepCost(preset: Pick<Preset, "type" | "open" | "cloud" | "prestep"> | undefined, modelId: string | undefined, engine: Engine): number {
+ if (!preset?.prestep || !modelId || presetModel(preset, engine) !== modelId) return 0;
+ return preset.prestep[engine].usd ?? 0;
+}
+
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;
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index f7429958..8429d682 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -8,6 +8,7 @@
import type { Generation, OutputFile, VideoFormat } from "./catalog/types";
import { cueText, type Cue } from "./cues";
import { downloadHref, downloadName, extensionOf } from "./library";
+import { PRESETS as GRADE_PRESETS } from "./grade";
export type OutputActionId =
| "animate"
@@ -115,7 +116,9 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
link("lipsync", "Lipsync", `/lipsync?video=${q(o.url)}`);
link("upscale", "Upscale", `/upscale/video?video=${q(o.url)}`);
link("add-sound", "Add sound", `/audio/video?video=${q(o.url)}`);
- link("grade", "Color grade", `/color-grade?video=${q(o.url)}`);
+ // A Fuobe DoP colour-grade effect: the clip opens in Color grading with its grade picked (one click to export).
+ const dopGrade = gradeOf(o);
+ link("grade", dopGrade ? `Apply the ${dopGrade.name} grade` : "Color grade", `/color-grade?video=${q(o.url)}${dopGrade ? `&preset=${q(dopGrade.id)}` : ""}`);
link("genjutsu", "Use in Genjutsu", `/genjutsu?video=${q(o.url)}`);
break;
}
@@ -167,12 +170,21 @@ export function nextSteps(g: Generation, index: number, max = 3): OutputAction[]
const o = g.outputs[index];
if (!o || g.status !== "succeeded") return [];
const all = outputActions(g, index);
- return (NEXT_STEPS[o.kind] ?? [])
+ // A clip with a grade still to apply (a Fuobe DoP colour-grade effect) offers it first.
+ const order: OutputActionId[] = o.kind === "video" && gradeOf(o) ? ["grade", ...(NEXT_STEPS.video ?? [])] : (NEXT_STEPS[o.kind] ?? []);
+ return order
.map((id) => all.find((a) => a.id === id && a.href))
.filter((a): a is OutputAction => !!a)
.slice(0, max);
}
+/** The grade a clip still asks for (meta.grade: a Fuobe DoP colour-grade effect), as a Color grading preset. */
+export function gradeOf(o: Pick<OutputFile, "kind" | "meta">): { id: string; name: string } | undefined {
+ const id = o.kind === "video" && typeof o.meta?.grade === "string" ? o.meta.grade : undefined;
+ const p = id ? GRADE_PRESETS.find((x) => x.id === id) : undefined;
+ return p && { id: p.id, name: p.name };
+}
+
/**
* A vector result (an SVG: Vectorize, Recraft's vector styles, an uploaded .svg). Demo pictures are
* SVG placeholders standing in for raster results, so they keep the raster hand-offs (except Vectorize's).
diff --git a/src/server/chains.ts b/src/server/chains.ts
index 300dd911..be3fce44 100644
--- a/src/server/chains.ts
+++ b/src/server/chains.ts
@@ -3,7 +3,7 @@ import { nanoid } from "nanoid";
import { getModel, supportsOp } from "@/lib/catalog";
import { chainTiming, frameTimes, planKeyframeClips, spread } from "@/lib/catalog/keyframes";
import { routesFor } from "@/lib/catalog/plan";
-import type { ChainSlot, Engine, Generation, GenerationRequest, ModelDef, ModelRoute, Operation } from "@/lib/catalog/types";
+import type { ChainSlot, Engine, Generation, GenerationRequest, LoraRef, ModelDef, ModelRoute, Operation } from "@/lib/catalog/types";
import { db } from "./db";
import { cancelGeneration, chooseRoute, createGenerations, getGeneration, previewChained, previewGeneration } from "./generations";
import { provider } from "./providers";
@@ -275,6 +275,44 @@ export function createExtendChain(original: GenerationRequest, model: ModelDef):
return [film, clip, frame];
}
+/**
+ * Fuobe DoP's relight effects (Silhouette, Window, Practicals…): the start frame is relit first (Qwen-Image-Edit 2509
+ * with its Relight LoRA, on the engine the clip runs on), then animated with the effect's words. One batch of two steps.
+ */
+export function createRelitClip(original: GenerationRequest, relight: { engine: Engine; step: { modelId: string; op: Operation; prompt: string; loras?: LoraRef[] } }): Generation[] {
+ const [image, ...rest] = original.inputs?.images ?? [];
+ if (!image) throw new Error("Add a start frame to relight");
+ const { engine, step } = relight;
+ assertOneMode([
+ { label: "Relighting the start frame", modelId: step.modelId, op: step.op },
+ { label: getModel(original.modelId)?.name ?? original.modelId, modelId: original.modelId, op: original.op ?? "i2v" },
+ ]);
+ const batchId = nanoid(10);
+ const relit = createGenerations(
+ {
+ feature: original.feature,
+ modelId: step.modelId,
+ op: step.op,
+ prompt: step.prompt,
+ inputs: { images: [image] },
+ ...(step.loras?.length && { loras: step.loras }),
+ step: { label: "Relit start frame", index: 0, of: 2 },
+ },
+ { batchId },
+ )[0];
+ const clip = createGenerations(
+ {
+ ...original,
+ engine,
+ inputs: { ...original.inputs, images: rest.length ? rest : undefined },
+ chain: [{ slot: "images", position: "first" }],
+ step: { label: "Relit clip", index: 1, of: 2 },
+ },
+ { batchId, dependsOn: relit.id },
+ )[0];
+ return [clip, relit];
+}
+
/** The model a storyboard film is animated with. */
export function filmModel(engine: Engine, modelId?: string): ModelDef {
const m = getModel(modelId ?? (engine === "open" ? "oss-wan22-14b-fast" : "seedance-2-5"));
diff --git a/src/server/generations.ts b/src/server/generations.ts
index 62cdea14..a96389a1 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -10,31 +10,35 @@ import { cueText, type Cue } from "@/lib/cues";
import { HELPER_FEATURES, HELPER_SUFFIX, isReviewStatus, type AssetUse, type ReviewFilter } from "@/lib/library";
import { upscaleTier } from "@/lib/av/upscale";
import { chainedWaitMessage, keyframeChain } from "@/lib/catalog/keyframes";
-import { estimateCost, inferOperation, planGeneration, routeLoras, routesFor } from "@/lib/catalog/plan";
+import { estimateCost, inferOperation, planGeneration, presetRoute, routeLoras, routesFor } from "@/lib/catalog/plan";
import { framedLength, keepMatte } from "@/lib/catalog/payload";
import { fitLoras, lorasFit } from "@/lib/catalog/loras";
import { dualEngine, onEngine, pickEngine } from "@/lib/catalog/engines";
import { promptWithLoras, soulKind, soulLook, soulPostSteps } from "@/lib/catalog/soul";
+import { isDop } from "@/lib/catalog/dop";
import { finishSteps } from "@/lib/soul-post";
import {
CHAIN_LIST_SLACK,
LAST_FRAME_CHAIN,
OPERATION_OUTPUT,
type ChainSlot,
+ type Engine,
type Generation,
type GenerationRequest,
type MediaKind,
type GenInput,
type LoraRef,
+ type ModelDef,
type ModelRoute,
type Operation,
type OutputFile,
+ type Preset,
type ProviderId,
} from "@/lib/catalog/types";
import { db } from "./db";
import { listElements } from "./elements";
import { pollTrainings } from "./training";
-import { createExtendChain, createKeyframeFilm, createShotFilm } from "./chains";
+import { createExtendChain, createKeyframeFilm, createRelitClip, createShotFilm } from "./chains";
import { enhancePrompt, enhanceSoulWords } from "./enhance";
import { setResolver, watchGenerations, type LiveEvent } from "./live";
import { provider } from "./providers";
@@ -424,6 +428,26 @@ setResolver((ids) =>
// ---------------------------------------------------------------------------
// Create
+/**
+ * The engine a model runs a request on: a Fuobe Original runs on the engine asked for (the composer's switch), else
+ * the engine mode, else the first one connected; any other model on its own.
+ */
+export function engineFor(m: ModelDef, asked: Engine | undefined): Engine {
+ return dualEngine(m) ? pickEngine(m, asked, engineMode(), (e) => onEngine(m, e).routes.some(routeReady)) : m.engine;
+}
+
+/**
+ * Fuobe DoP's relight effects (Silhouette, Window…) on their own model: the step that relights the start frame on the
+ * engine the clip runs on. None for any other request (the effect on a partner model runs on its words).
+ */
+export function relightStep(req: GenerationRequest, model: ModelDef): { engine: Engine; step: NonNullable<Preset["prestep"]>["open"] } | undefined {
+ const preset = req.presetId ? getPreset(req.presetId) : undefined;
+ if (!preset?.prestep || !req.inputs?.images?.length) return undefined;
+ const engine = engineFor(model, req.engine);
+ if (presetRoute(preset, engine)?.modelId !== model.id) return undefined;
+ return { engine, step: preset.prestep[engine] };
+}
+
/** Resolve mentions and drawings, plan, enforce the engine mode and pick a provider route. */
function prepare(original: GenerationRequest) {
// @element mentions become reference images / LoRAs; the stored request keeps the mentions for "Reuse".
@@ -431,8 +455,7 @@ function prepare(original: GenerationRequest) {
const worded = withSignatureWords(original);
const mode = engineMode();
const found = getModel(worded.modelId);
- // A Fuobe Original runs on the engine asked for (the composer's switch), else the engine mode, else the first one connected.
- const model = found && dualEngine(found) ? onEngine(found, pickEngine(found, worded.engine, mode, (e) => onEngine(found, e).routes.some(routeReady))) : found;
+ const model = found && dualEngine(found) ? onEngine(found, engineFor(found, worded.engine)) : found;
const lookup = (id: string) => (model && id === model.id ? model : getModel(id));
const req = model ? stripMotionPaths(applySketch(applyMentions(worded, model, listElements()).request, model).request, model) : worded;
let plan = planGeneration(req, lookup, getPreset);
@@ -534,8 +557,10 @@ export interface CreateOptions {
const depIds = (v: string | null): string[] => (!v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v]);
export function createGenerations(original: GenerationRequest, opts: CreateOptions = {}): Generation[] {
- // Open models make multi-shot films shot by shot, then join the clips.
- const shotModel = getModel(original.modelId);
+ // Open models make multi-shot films shot by shot, then join the clips. A Fuobe Original is taken on the engine it runs
+ // on (Fuobe DoP's Frames mode is a GPU chain).
+ const found = getModel(original.modelId);
+ const shotModel = found && dualEngine(found) ? onEngine(found, engineFor(found, original.engine)) : found;
if (!opts.dependsOn && shotModel?.options.multiShot?.mode === "concat" && (original.params?.shots?.filter((x) => x.prompt.trim()).length ?? 0) > 1) {
return createShotFilm(original, shotModel);
}
@@ -545,6 +570,9 @@ export function createGenerations(original: GenerationRequest, opts: CreateOptio
// Frames mode on an open model: one start/end-frame clip per pair of frames, then joined.
const filmRoute = shotModel && keyframeChain(shotModel);
if (!opts.dependsOn && filmRoute && inferOperation(shotModel, original) === "keyframes") return createKeyframeFilm(original, shotModel, filmRoute);
+ // Fuobe DoP's relight effects: the start frame is relit first, then animated.
+ const relight = !opts.dependsOn && shotModel ? relightStep(original, shotModel) : undefined;
+ if (relight) return createRelitClip(original, relight);
const deps = opts.dependsOn === undefined ? [] : Array.isArray(opts.dependsOn) ? opts.dependsOn : [opts.dependsOn];
const waits = deps.length > 0;
// A dependent job can't be planned until its inputs exist; it's validated with placeholders, then launched by the runner.
@@ -1200,6 +1228,9 @@ async function pollOne(r: Row): Promise<void> {
// API clients read it as meta.
const post = soulPostSteps(r.model_id, r.preset_id, soulKind(r.model_id) ? requestAspect(r.request_json) : undefined);
if (post) for (const [i, o] of outputs.entries()) if (o.kind === "image") outputs[i] = { ...o, meta: { ...o.meta, ...post } };
+ // Fuobe DoP's colour-grade effects: the grade the browser applies to the clip (the result's "Apply the grade" step).
+ const grade = isDop(r.model_id) && r.preset_id ? getPreset(r.preset_id)?.grade : undefined;
+ if (grade) for (const [i, o] of outputs.entries()) if (o.kind === "video") outputs[i] = { ...o, meta: { ...o.meta, grade } };
update(r.id, {
status: "succeeded",
outputs_json: JSON.stringify(outputs),
diff --git a/tests/composer-frames.test.ts b/tests/composer-frames.test.ts
index d97dffc9..a8fa1fc8 100644
--- a/tests/composer-frames.test.ts
+++ b/tests/composer-frames.test.ts
@@ -122,9 +122,10 @@ describe("Frames mode in the Video studio composer", () => {
return planGeneration({ feature: "video", modelId: id, presetId, op: sent.op, prompt: "a fox", inputs: { images: sent.images }, params: sent.params }, getModel, getPreset);
};
expect(run("flux-3-max", preset.id)).toMatchObject({ op: "keyframes", prompt: expect.stringMatching(/zooms in/) });
- // Dolly In runs on Wan 2.2 14B with a LoRA: its own operation is image-to-video, which would drop frames 2 and 3.
- expect(getPreset("motion-dolly-in")?.open).toMatchObject({ modelId: "oss-wan22-14b", op: "i2v" });
- const dolly = run("oss-wan22-14b", "motion-dolly-in");
+ // Dolly In runs on Fuobe DoP (Wan 2.2 14B on the GPU) with a LoRA: its own operation is image-to-video, which would
+ // drop frames 2 and 3.
+ expect(getPreset("motion-dolly-in")?.open).toMatchObject({ modelId: "fuobe-dop", op: "i2v" });
+ const dolly = run("fuobe-dop", "motion-dolly-in");
expect(dolly.op).toBe("keyframes");
expect(dolly.loras.length).toBeGreaterThan(0);
});
diff --git a/tests/dop-originals.test.ts b/tests/dop-originals.test.ts
new file mode 100644
index 00000000..f26a8045
--- /dev/null
+++ b/tests/dop-originals.test.ts
@@ -0,0 +1,248 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
+import type { ComfyWorkflow } from "@/lib/comfy";
+import type { GenerationRequest, GenInput, ModelDef, ModelRoute } from "@/lib/catalog/types";
+
+// Fuobe DoP as a run (build plan O4): one model on both engines for the camera motions and effects, the cloud payload
+// from the research's FieldMaps (49 or 81 frames at 16 fps, interpolation off), Mix on both engines, the LTX-2.3 graphs
+// with LoRAs, the Fun Camera pose, the relight step and the grade the browser applies.
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-dop-"));
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://127.0.0.1:9"; // nothing listens here: open runs fall back to the demo
+
+const { setSetting } = await import("@/server/settings");
+const { createGenerations, previewGeneration } = await import("@/server/generations");
+const { prepareWorkflow } = await import("@/server/providers/comfyui");
+const { falProvider } = await import("@/server/providers/fal");
+const { getModel, getPreset, modelsFor } = await import("@/lib/catalog");
+const { onEngine } = await import("@/lib/catalog/engines");
+const { estimateCost, planGeneration, routesFor } = await import("@/lib/catalog/plan");
+const { presetModel, prestepCost } = await import("@/lib/composer");
+const { gradeOf, nextSteps } = await import("@/lib/output-actions");
+const { lorasFit } = await import("@/lib/catalog/loras");
+
+beforeAll(() => setSetting("demoMode", "auto"));
+afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
+
+const view = (id: string, engine: "open" | "cloud") => onEngine(getModel(id)!, engine);
+const plan = (engine: "open" | "cloud", req: Partial<GenerationRequest> & { presetId?: string }, modelId = presetModel(getPreset(req.presetId ?? "")!, engine) ?? "fuobe-dop") => {
+ const m = view(modelId, engine);
+ return planGeneration({ feature: "motion", modelId: m.id, prompt: "a woman in a red coat on a bridge", inputs: { images: ["/a.png"] }, ...req }, (id) => (id === m.id ? m : getModel(id)), getPreset);
+};
+const falRoute = (m: ModelDef, op = "i2v") => m.routes.find((r) => r.provider === "fal" && r.op === op)!;
+
+/** Submit through the fal adapter and return the URL and JSON body it posted. */
+async function submit(model: ModelDef, route: ModelRoute, input: GenInput): Promise<{ url: string; body: Record<string, unknown> }> {
+ const real = globalThis.fetch;
+ let seen: { url: string; body: Record<string, unknown> } | undefined;
+ globalThis.fetch = (async (url: string, init?: RequestInit) => {
+ seen = { url: String(url), body: JSON.parse(String(init?.body ?? "{}")) };
+ return new Response(JSON.stringify({ request_id: "r1", status_url: "s", response_url: "r", cancel_url: "c" }), { status: 200 });
+ }) as typeof fetch;
+ try {
+ await falProvider.submit({ generationId: "g", model, route, input });
+ } finally {
+ globalThis.fetch = real;
+ }
+ return seen!;
+}
+
+const ctx = (media: (n: unknown) => unknown = () => undefined) => ({
+ generationId: "g",
+ op: "i2v" as const,
+ upload: async (_d: Buffer, _t: string, name: string) => `up_${name}`,
+ media: media as never,
+ serverRam: async () => undefined,
+});
+
+describe("Fuobe DoP on both engines", () => {
+ it("is one model with ComfyUI routes and hosted open-weight routes, 480p on the GPU and 720p in the cloud", () => {
+ const m = getModel("fuobe-dop")!;
+ expect(m.engines).toEqual(["open", "cloud"]);
+ expect(view("fuobe-dop", "open").routes.map((r) => [r.op, r.endpoint])).toEqual([["i2v", "wan22-i2v-14b"], ["flf2v", "wan22-flf2v-14b"], ["keyframes", "wan22-flf2v-14b"]]);
+ expect(new Set(view("fuobe-dop", "cloud").routes.map((r) => r.provider))).toEqual(new Set(["fal", "replicate"]));
+ expect(view("fuobe-dop", "open").defaults).toMatchObject({ resolution: "480p", duration: 5, aspectRatio: "auto" });
+ expect(view("fuobe-dop", "cloud").defaults).toMatchObject({ resolution: "720p", duration: 5 });
+ expect(view("fuobe-dop-ltx", "open").routes.map((r) => [r.op, r.endpoint])).toEqual([["i2v", "ltx23-i2v-lora"], ["flf2v", "ltx23-flf2v-lora"]]);
+ for (const engine of ["open", "cloud"] as const) expect(modelsFor({ kind: "video", engine }).some((x) => x.id === "fuobe-dop")).toBe(true);
+ });
+
+ it("asks for a start frame", () => {
+ expect(() => plan("open", { inputs: undefined, prompt: "a slow push in" })).toThrow(/start frame/);
+ });
+
+ it("sends 49 or 81 frames at 16 fps with interpolation off and 20 steps, each LoRA on its expert", async () => {
+ const m = view("fuobe-dop", "cloud");
+ const p = plan("cloud", { presetId: "motion-overhead" });
+ expect(p.loras.map((l) => l.target)).toEqual(["high", "low"]);
+ const loras = p.loras.map((l) => ({ ...l, hostedUrl: `https://v3.fal.media/files/${l.version}.safetensors` }));
+ for (const [duration, frames] of [[5, 81], [3, 49]] as const) {
+ const { url, body } = await submit(m, falRoute(m), { ...p.params, duration, prompt: p.prompt, images: ["https://fal.media/a.png"], loras });
+ expect(url).toContain("fal-ai/wan/v2.2-a14b/image-to-video/lora");
+ expect(body).toMatchObject({ num_frames: frames, frames_per_second: 16, interpolator_model: "none", num_inference_steps: 20, resolution: "720p" });
+ expect((body.loras as { transformer: string }[]).map((l) => l.transformer)).toEqual(["high", "low"]);
+ }
+ // Without a LoRA (a move on its words) the plain endpoint, at the same frame rate.
+ const words = plan("cloud", { presetId: "motion-whip-pan" });
+ const plain = await submit(m, falRoute(m), { ...words.params, prompt: words.prompt, images: ["https://fal.media/a.png"] });
+ expect(plain.url).toMatch(/fal-ai\/wan\/v2\.2-a14b\/image-to-video$/);
+ expect(plain.body).toMatchObject({ num_frames: 81, frames_per_second: 16, interpolator_model: "none" });
+ });
+
+ it("prices the clip: free on the GPU, the LoRA endpoint's $0.10/s in the cloud", () => {
+ const p = plan("cloud", { presetId: "motion-overhead" });
+ expect(estimateCost(view("fuobe-dop", "cloud"), p.params, 1, "i2v", true)).toBeCloseTo(0.5);
+ expect(estimateCost(view("fuobe-dop", "cloud"), { ...p.params, duration: 3 }, 1, "i2v", true)).toBeCloseTo(0.3);
+ expect(estimateCost(view("fuobe-dop", "open"), p.params, 1, "i2v")).toBe(0);
+ });
+});
+
+describe("Mix on both engines", () => {
+ it("sends both presets' LoRAs, each scaled by its strength, with the second one's trigger", () => {
+ for (const engine of ["open", "cloud"] as const) {
+ const p = plan(engine, { presetId: "motion-overhead", presetStrength: 0.8, mix: { presetId: "effect-building-explosion", strength: 0.5 } });
+ expect(p.loras.map((l) => l.strength)).toEqual([0.8, 0.8, 0.5, 0.5]);
+ expect(p.loras.slice(2).every((l) => /explosion-redmond/.test(l.file))).toBe(true);
+ expect(p.prompt).toMatch(/Also, more subtly: explosion, /);
+ }
+ // Two Wan 2.2 pairs fit fal's list, not Replicate's one LoRA per expert: the run goes to fal.
+ const both = plan("cloud", { presetId: "motion-overhead", mix: { presetId: "effect-building-explosion", strength: 0.5 } });
+ const m = view("fuobe-dop", "cloud");
+ expect(lorasFit(falRoute(m), both.loras)).toBe(true);
+ expect(lorasFit(m.routes.find((r) => r.provider === "replicate")!, both.loras)).toBe(false);
+ });
+
+ it("joins a preset whose LoRA is for another base as words, and says so", () => {
+ const p = plan("open", { presetId: "motion-overhead", mix: { presetId: "motion-fpv-drone", strength: 0.9 } });
+ expect(p.loras).toHaveLength(2);
+ expect(p.notes?.join(" ")).toMatch(/FPV Drone's LoRA runs on LTX-2\.3, so it joins this mix as words only/);
+ expect(p.prompt).toMatch(/At the same time: /);
+ });
+
+ it("gives a partner model the words without the LoRA's trigger", () => {
+ const kling = planGeneration({ feature: "motion", modelId: "kling-2-5-turbo", presetId: "effect-thunder-god", prompt: "a knight", inputs: { images: ["/a.png"] } }, getModel, getPreset);
+ expect(kling.loras).toEqual([]);
+ expect(kling.prompt.startsWith("a knight. ")).toBe(true);
+ expect(plan("open", { presetId: "effect-thunder-god", prompt: "a knight" }).prompt.startsWith("Thunder Hero. a knight. ")).toBe(true);
+ });
+});
+
+describe("Fuobe DoP · LTX", () => {
+ it("runs a camera LoRA alone on the plain LTX-2.3 endpoint, its strength on camera_lora_scale, silent and unexpanded", async () => {
+ const m = view("fuobe-dop-ltx", "cloud");
+ const p = plan("cloud", { presetId: "motion-jib-up", presetStrength: 0.6 });
+ expect(p.model.id).toBe("fuobe-dop-ltx");
+ expect(p.loras).toEqual([]);
+ const { url, body } = await submit(m, falRoute(m), { ...p.params, ...p.params.extra, prompt: p.prompt, images: ["https://fal.media/a.png"] } as GenInput);
+ expect(url).toMatch(/fal-ai\/ltx-2\.3-22b\/image-to-video$/);
+ expect(body).toMatchObject({ camera_lora: "jib_up", camera_lora_scale: 0.6, enable_prompt_expansion: false, generate_audio: false, num_frames: 121 });
+ });
+
+ it("sends a transition's LoRA with both frames to the LTX-2.3 LoRA endpoint", async () => {
+ const m = view("fuobe-dop-ltx", "cloud");
+ const p = plan("cloud", { presetId: "effect-melt-transition", inputs: { images: ["/a.png"], endImage: "/b.png" } });
+ expect(p.op).toBe("flf2v");
+ const { url, body } = await submit(m, falRoute(m, "flf2v"), { ...p.params, prompt: p.prompt, images: ["https://fal.media/a.png"], endImage: "https://fal.media/b.png", loras: p.loras });
+ expect(url).toContain("fal-ai/ltx-2.3-22b/image-to-video/lora");
+ expect(body).toMatchObject({ image_url: "https://fal.media/a.png", end_image_url: "https://fal.media/b.png" });
+ expect((body.loras as { path: string }[])[0].path).toMatch(/ltx2\.3-transition\.safetensors$/);
+ expect(p.prompt.startsWith("zhuanchang. ")).toBe(true);
+ });
+
+ it("injects the LoRAs after the LTX-2.3 checkpoint and sizes the clip from the start frame on the GPU", async () => {
+ const p = plan("open", { presetId: "motion-fpv-drone", params: { aspectRatio: "auto", duration: 5 } });
+ const { workflow } = await prepareWorkflow(
+ "ltx23-i2v-lora",
+ { ...p.params, prompt: p.prompt, images: ["up_a.png"], loras: p.loras, seed: 3 },
+ ctx((n) => (n === "up_a.png" ? { container: "image", width: 1080, height: 1920, hasVideo: false, hasAudio: false } : undefined)),
+ );
+ const wf = workflow as ComfyWorkflow;
+ const lora = Object.entries(wf).find(([, n]) => n.class_type === "LoraLoaderModelOnly")!;
+ expect(lora[1].inputs.lora_name).toBe(p.loras[0].file);
+ const ckpt = Object.entries(wf).find(([, n]) => n.class_type === "CheckpointLoaderSimple")![0];
+ expect(lora[1].inputs.model).toEqual([ckpt, 0]);
+ // The guider samples with the LoRA's model, not the bare checkpoint.
+ expect(Object.values(wf).find((n) => n.class_type === "CFGGuider")!.inputs.model).toEqual([lora[0], 0]);
+ expect(wf["130"].inputs.value).toBe(121);
+ expect(wf["114"].inputs.value).toBe(24);
+ const [w, h] = [wf["113"].inputs.value as number, wf["98"].inputs.value as number];
+ expect(w % 32).toBe(0);
+ expect(h % 32).toBe(0);
+ expect(h).toBeGreaterThan(w);
+ expect(wf["31"].inputs.image).toBe("up_a.png");
+ });
+});
+
+describe("Fuobe DoP on the GPU", () => {
+ it("runs a Fun Camera pose on its graph, a LoRA mixed in on its experts", async () => {
+ const p = plan("open", { presetId: "motion-zoom", mix: { presetId: "effect-building-explosion", strength: 0.7 } });
+ expect(routesFor(p.model, "i2v")[0].endpoint).toBe("wan22-i2v-14b");
+ expect(p.params.extra).toEqual({ cameraMotion: "Zoom In" });
+ const { manifest, workflow } = await prepareWorkflow("wan22-i2v-14b", { ...p.params, prompt: p.prompt, images: ["up_a.png"], loras: p.loras, seed: 1 }, ctx());
+ expect(manifest.id).toBe("wan22-fun-camera-14b");
+ const wf = workflow as ComfyWorkflow;
+ expect(Object.values(wf).find((n) => n.class_type === "WanCameraEmbedding")!.inputs.camera_pose).toBe("Zoom In");
+ const loras = Object.values(wf).filter((n) => n.class_type === "LoraLoaderModelOnly").map((n) => n.inputs.lora_name);
+ expect(loras.sort()).toEqual(p.loras.map((l) => l.file).sort());
+ // Without a pose the plain image-to-video graph.
+ const plain = await prepareWorkflow("wan22-i2v-14b", { prompt: "x", images: ["up_a.png"], duration: 3, resolution: "480p", aspectRatio: "16:9" }, ctx());
+ expect(plain.manifest.id).toBe("wan22-i2v-14b");
+ });
+
+ it("runs an LTX-2.5 LoRA on the open LTX-2.5 graph, and its words in the cloud", () => {
+ expect(plan("open", { presetId: "motion-slow-motion" }).model.id).toBe("oss-ltx25");
+ const cloud = plan("cloud", { presetId: "motion-slow-motion" });
+ expect(cloud.model.id).toBe("fuobe-dop");
+ expect(cloud.loras).toEqual([]);
+ });
+});
+
+describe("effects as steps", () => {
+ it("grades a colour-grade effect in the browser: the clip carries the grade, its next step applies it", () => {
+ const p = plan("cloud", { presetId: "effect-candy-pink" });
+ expect(p.dop).toEqual({ grade: "candy-pink" });
+ expect(p.loras).toEqual([]);
+ // A partner model runs the words, nothing to grade.
+ expect(planGeneration({ feature: "motion", modelId: "kling-2-5-turbo", presetId: "effect-candy-pink", prompt: "x", inputs: { images: ["/a.png"] } }, getModel, getPreset).dop).toBeUndefined();
+ const g = {
+ id: "gen123",
+ status: "succeeded",
+ prompt: "a woman on a bridge",
+ modelId: "fuobe-dop",
+ op: "i2v",
+ request: { feature: "motion", modelId: "fuobe-dop", presetId: "effect-candy-pink" },
+ outputs: [{ url: "/api/files/outputs/c.mp4", kind: "video", meta: { grade: "candy-pink" } }],
+ } as never;
+ expect(gradeOf({ kind: "video", meta: { grade: "candy-pink" } })).toEqual({ id: "candy-pink", name: "Candy Pink" });
+ expect(nextSteps(g, 0)[0]).toMatchObject({ id: "grade", label: "Apply the Candy Pink grade", href: "/color-grade?video=%2Fapi%2Ffiles%2Foutputs%2Fc.mp4&preset=candy-pink" });
+ });
+
+ it("relights the start frame first, then animates the relit picture, on the engine asked for", () => {
+ const req = { feature: "motion", modelId: "fuobe-dop", presetId: "effect-window", prompt: "a woman reading", inputs: { images: ["/api/files/uploads/a.png"] } };
+ for (const engine of ["open", "cloud"] as const) {
+ const [clip, relit] = createGenerations({ ...req, engine });
+ expect(relit.modelId).toBe(engine === "open" ? "oss-qwen-relight" : "qwen-image-edit-2509-cloud");
+ expect(relit.op).toBe("edit");
+ expect(clip.modelId).toBe("fuobe-dop");
+ expect(clip.engine).toBe(engine);
+ expect(clip.request.chain).toEqual([{ slot: "images", position: "first" }]);
+ expect(clip.request.inputs?.images).toBeUndefined();
+ if (engine === "cloud") expect(relit.request.loras?.map((l) => l.file)).toEqual(["Qwen-Image-Edit-2509-Relight.safetensors"]);
+ }
+ // The price says so before the run: about $0.04 in the cloud, free on the GPU.
+ const window = getPreset("effect-window")!;
+ expect(prestepCost(window, "fuobe-dop", "cloud")).toBeCloseTo(0.035);
+ expect(prestepCost(window, "fuobe-dop", "open")).toBe(0);
+ expect(prestepCost(window, "kling-2-5-turbo", "cloud")).toBe(0);
+ // On a partner model the effect is its words: no relight step.
+ expect(createGenerations({ ...req, modelId: "kling-2-5-turbo" })).toHaveLength(1);
+ });
+
+ it("previews a DoP motion on the engine asked for, free on the GPU", () => {
+ const open = previewGeneration({ feature: "motion", modelId: "fuobe-dop", presetId: "motion-overhead", prompt: "x", inputs: { images: ["/a.png"] }, engine: "open" });
+ expect(open).toMatchObject({ engine: "open", costUsd: 0, route: { provider: "comfyui", endpoint: "wan22-i2v-14b" } });
+ expect(open.loras.applied.map((l) => l.file)).toHaveLength(2);
+ });
+});