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.

Image tools: each model gets the pictures it reads, and saved runs follow the moved models

Adarsh6dfc81df7ab5
diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsx
index 503fa840..3a4b1b88 100644
--- a/src/components/storyboard-view.tsx
+++ b/src/components/storyboard-view.tsx
@@ -319,6 +319,9 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
const boardPartner = engine === "cloud" ? partner : undefined;
const m = storyboardModels(engine as Engine, boardPartner);
const nextName = `${modelNames[m.next] ?? m.next}${m.nextLoras?.length ? " with the next-scene LoRA" : ""}`;
+ // Frame 1's model (with references: the edit that takes them), named when it isn't the one that makes the rest.
+ const firstId = refs.length ? m.firstWithRefs : m.first;
+ const runsOn = firstId === m.next ? ` Runs on ${nextName}.` : ` Frame 1 on ${modelNames[firstId] ?? firstId}, then ${nextName}.`;
const lookName = look ? lookCard(look)?.name : undefined;
const filled = scenes.filter((s) => s.trim());
const boardBody = {
@@ -393,7 +396,7 @@ 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.
- {lookName && !refs.length ? ` Frame 1 on ${modelNames[STORYBOARD_LOOK_MODEL] ?? "Fuobe Soul"} in the ${lookName} look, then ${nextName}.` : ` Runs on ${nextName}.`}
+ {lookName && !refs.length ? ` Frame 1 on ${modelNames[STORYBOARD_LOOK_MODEL] ?? "Fuobe Soul"} in the ${lookName} look, then ${nextName}.` : runsOn}
</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">
diff --git a/src/lib/catalog/mixed-media.ts b/src/lib/catalog/mixed-media.ts
index 4a89b7bd..e29d368c 100644
--- a/src/lib/catalog/mixed-media.ts
+++ b/src/lib/catalog/mixed-media.ts
@@ -70,6 +70,8 @@ export const MIXED_MODES: Record<Engine, MixedMode[]> = { cloud: ["frames", "smo
* Seedream 5.0 Flash, which redraw each frame looking at the one styled before it.
*/
export const MIXED_FRAME_MODELS = [MIXED_ORIGINAL, "nano-banana-2-1", "seedream-5-flash"] as const;
+/** Frame models Per frame no longer lists, and the one a render that names them (a saved setup, an API caller) runs on now. */
+export const MIXED_FRAME_MOVES: Readonly<Record<string, string>> = { "nano-banana-2": "nano-banana-2-1" };
/**
* Cloud per-frame limits: fal's extract-nth-frame returns up to 500 frames a call and images-to-video
diff --git a/src/lib/catalog/packs.ts b/src/lib/catalog/packs.ts
index 89477ac9..e19f6bf9 100644
--- a/src/lib/catalog/packs.ts
+++ b/src/lib/catalog/packs.ts
@@ -374,7 +374,10 @@ export const PHOTO_EDIT: Record<Engine, string> = { cloud: "qwen-image-edit-2511
export const OPEN_PHOTO_EDIT = PHOTO_EDIT.open;
/** Its 8-step Turbo (up to 4 references). */
export const OPEN_PHOTO_EDIT_TURBO = "oss-qwen-image-21-turbo";
-/** Krea 2 Identity Edit: restages the person in one photo (a new place, pose or outfit, the same face). */
+/**
+ * Krea 2 Identity Edit: restages the person in one photo (a new place, pose or outfit, the same face). With two pictures
+ * it reads the scene first and the person last (its likeness boost goes to the last one).
+ */
export const OPEN_IDENTITY_EDIT = "oss-krea2-identity-edit";
/** The models a pack's photos can run on, the default first after Fuobe Soul (which needs a trained Soul ID). */
@@ -422,9 +425,12 @@ export function photodumpModel(subject: PhotoSubject, engine: Engine, _caps: Pla
const KEEP_FACE = "Keep their exact face, identity, skin tone and hair, in a freshly composed new photo";
-/** One photo's prompt for a subject: an @mention for saved characters, image 1 for a selfie. */
-export function shotPrompt(pack: Pick<Pack, "look" | "custom">, shot: string, subject: PhotoSubject, refIndex?: number): string {
- const who = subject.kind === "element" ? `@${subject.handle}` : "the person in image 1";
+/**
+ * One photo's prompt for a subject: an @mention for saved characters, image 1 for a selfie (image `selfieIndex` when
+ * the model takes the person last).
+ */
+export function shotPrompt(pack: Pick<Pack, "look" | "custom">, shot: string, subject: PhotoSubject, refIndex?: number, selfieIndex = 1): string {
+ const who = subject.kind === "element" ? `@${subject.handle}` : `the person in image ${selfieIndex}`;
const look = pack.look ? ` ${pack.look}.` : "";
if (pack.custom && refIndex) {
const lead = who.charAt(0).toUpperCase() + who.slice(1);
@@ -450,7 +456,8 @@ export interface PhotodumpPlan {
/**
* One request per photo of the pack, in order ("Photo 3 of 15"), each making one image. Saved
* characters are @mentioned (the server turns that into their trained Soul ID LoRA or reference photos);
- * a selfie goes in as image 1. User packs add their reference photo after the subject.
+ * a selfie goes in as image 1. User packs add their reference photo after the subject; on Krea 2 Identity Edit, which
+ * reads the scene first and the person last, the reference photo goes first and a saved character is one of their photos.
*/
export function planPhotodump(input: PhotodumpInput, caps: PlanCaps): PhotodumpPlan {
const { pack, subject } = input;
@@ -461,18 +468,24 @@ export function planPhotodump(input: PhotodumpInput, caps: PlanCaps): PhotodumpP
if (route.note) notes.push(route.note);
const n = pack.shots.length;
const aspect = input.aspectRatio && input.aspectRatio !== "auto" ? input.aspectRatio : undefined;
+ // Krea 2 Identity Edit takes the scene first and the person last, and reads two pictures as two people: a saved
+ // character goes in as one of their photos (an @mention would attach two), and a user pack's reference leads.
+ const sceneFirst = route.modelId === OPEN_IDENTITY_EDIT;
+ const onePhoto = sceneFirst && subject.kind === "element" ? subject.references[0] : undefined;
+ const person: PhotoSubject = onePhoto ? { kind: "selfie", url: onePhoto } : subject;
const requests = pack.shots.map((shot, i): GenerationRequest => {
- const own = subject.kind === "selfie" ? [subject.url] : [];
+ const own = person.kind === "selfie" ? [person.url] : [];
const ref = pack.refs?.[i];
// User packs: the reference goes after the identity images; @mention references come after those (applyMentions appends).
- const images = ref ? [...own, ref] : own;
- const refIndex = ref ? images.length : undefined;
+ const images = ref ? (sceneFirst ? [ref, ...own] : [...own, ref]) : own;
+ const refIndex = ref ? (sceneFirst ? 1 : own.length + 1) : undefined;
+ const selfieIndex = ref && sceneFirst ? 2 : 1;
return {
feature: "photodump",
modelId: route.modelId,
// Fuobe Soul runs on both engines: the run's engine picks its half.
engine: input.engine,
- prompt: shotPrompt(pack, shot, subject, refIndex),
+ prompt: shotPrompt(pack, shot, person, refIndex, selfieIndex),
inputs: images.length ? { images } : undefined,
params: { numOutputs: 1, ...(aspect && { aspectRatio: aspect }) },
step: { label: `Photo ${i + 1} of ${n}`, index: i, of: n },
@@ -606,13 +619,13 @@ export const getTemplate = (id: string) => FASHION.find((t) => t.id === id);
/**
* Fashion Factory's models per step (build plan O10): Fuobe Try-On (FLUX.2 [klein] 4B + the try-on LoRA) dresses the
* base shot on both engines, FASHN and Nano Banana Pro stay as cloud choices, and on your GPU Qwen-Image 2.1 Turbo
- * (then Krea 2 Identity Edit) dresses it when the try-on can't run. Qwen-Image-Edit 2511 makes the photoset in the
+ * (then Qwen-Image 2.1 at 25 steps) dresses it when the try-on can't run: its second picture is a garment, not a person. Qwen-Image-Edit 2511 makes the photoset in the
* cloud, Nano Banana Pro a choice; on your GPU Qwen-Image 2.1 makes it, Krea 2 Identity Edit (a new pose and place,
* the same person) a choice.
*/
export const TRYON_MODEL = "fuobe-tryon";
export const FASHION_MODELS = {
- outfit: { cloud: [TRYON_MODEL, "fashn-tryon", "nano-banana-pro"], open: [TRYON_MODEL, OPEN_PHOTO_EDIT_TURBO, OPEN_IDENTITY_EDIT] },
+ outfit: { cloud: [TRYON_MODEL, "fashn-tryon", "nano-banana-pro"], open: [TRYON_MODEL, OPEN_PHOTO_EDIT_TURBO, OPEN_PHOTO_EDIT] },
photoset: { cloud: [PHOTO_EDIT.cloud, "nano-banana-pro"], open: [OPEN_PHOTO_EDIT, OPEN_IDENTITY_EDIT] },
} as const;
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index 4881794c..3e6f67d3 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -119,10 +119,16 @@ export function presetRoute(preset: Preset, engine: Engine): PresetRoute | null
export { presetRoutes };
/**
- * The model apps ran on before they moved to a newer one (2026-10-31, the owner's newest image models): the edit apps
- * left Qwen-Image-Edit 2511, Expand and Zoom Out left FLUX Fill, both for Qwen-Image 2.1.
+ * The model apps ran on before they moved to a newer one: the edit apps left Qwen-Image-Edit 2511, Expand and Zoom Out
+ * left FLUX Fill, both for Qwen-Image 2.1 (2026-10-31); the talking apps left Kling AI Avatar for Kling Avatar 2.0 in
+ * the cloud, and Upscale left 4x ESRGAN for SeedVR2 on your GPU (2026-11-01).
*/
-const APP_MODEL_MOVES: Readonly<Record<string, string>> = { "oss-qwen-edit": "oss-qwen-image-21", "oss-flux-fill": "oss-qwen-image-21" };
+const APP_MODEL_MOVES: Readonly<Record<string, string>> = {
+ "oss-qwen-edit": "oss-qwen-image-21",
+ "oss-flux-fill": "oss-qwen-image-21",
+ "kling-avatar": "kling-avatar-2",
+ "oss-upscale-image": "oss-seedvr2-image",
+};
/**
* Apps pin their model, so a stored app run on the model its app ran on before (a retry, Run again, Reuse, a script)
diff --git a/src/lib/layers.ts b/src/lib/layers.ts
index 387d973a..a1888562 100644
--- a/src/lib/layers.ts
+++ b/src/lib/layers.ts
@@ -232,7 +232,8 @@ export const TOOL_LABELS: Record<LayerTool, string> = {
export const TOOL_MODELS: Record<LayerTool, { cloud: string[]; open: string[] }> = {
decompose: { cloud: ["seedream-5-layers", "seedream-5-flash-layers", "qwen-image-layered-cloud"], open: ["oss-qwen-layered"] },
split: { cloud: ["seedream-5-layers", "seedream-5-flash-layers", "qwen-image-layered-cloud"], open: ["oss-qwen-layered", "oss-qwen-layered-control"] },
- regenerate: { cloud: ["nano-banana-pro", "seedream-5-pro", "nano-banana-2-1"], open: ["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit", "oss-fibo2-edit-turbo"] },
+ // Layer edit sends the layer and up to 3 references: Krea 2 Edit isn't offered here, it takes 2 and reads the second as a person.
+ regenerate: { cloud: ["nano-banana-pro", "seedream-5-pro", "nano-banana-2-1"], open: ["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-fibo2-edit-turbo"] },
"generate-layer": { cloud: ["nano-banana-pro", "seedream-5-pro"], open: ["oss-qwen-image-21", "oss-ideogram-4", "oss-krea2-turbo", "oss-moss-image"] },
// Ideogram ($0.09) also lifts the text off the picture, which the editor doesn't use; Florence-2 only
// reads it (fal lists $0 per compute second, real cost unverified: the catalog's $0.001 is a placeholder).
@@ -246,11 +247,12 @@ export const TOOL_MODELS: Record<LayerTool, { cloud: string[]; open: string[] }>
relight: { cloud: ["nano-banana-pro", "nano-banana-2-1"], open: ["oss-qwen-image-21-turbo", "oss-krea2-edit", "oss-qwen-relight"] },
// Qwen-Image 2.1 at 25 steps on plain camera words (its Turbo misses big camera turns).
angles: { cloud: ["qwen-multiple-angles", "nano-banana-pro"], open: ["oss-qwen-image-21"] },
- // Both open graphs grow the canvas themselves from the pads; Krea 2 Inpaint needs its add-on (Ostris Edit).
- expand: { cloud: ["nano-banana-pro"], open: ["oss-qwen-image-21", "oss-krea2-inpaint"] },
+ // Both open graphs grow the canvas themselves from the pads. Krea 2 Inpaint isn't offered here: its graph scales the
+ // picture to about 1 MP and redraws all of it, and it needs the Ostris Edit add-on.
+ expand: { cloud: ["nano-banana-pro"], open: ["oss-qwen-image-21", "oss-flux-fill"] },
// Nano Banana Pro sees the painted area tinted red (Higgsfield's nano_banana_pro_inpaint); the others take the mask itself
// (Bria FIBO 2's edit keeps a single picture's own shape).
- inpaint: { cloud: ["nano-banana-pro", "bria-fibo-2", "z-image-inpaint"], open: ["oss-qwen-image-21", "oss-krea2-inpaint"] },
+ inpaint: { cloud: ["nano-banana-pro", "bria-fibo-2", "z-image-inpaint"], open: ["oss-qwen-image-21", "oss-flux-fill"] },
// The retouch looks; Detail runs on {@link ENHANCE_DETAIL_MODELS}.
enhance: { cloud: ["nano-banana-pro", "seedream-5-pro"], open: ["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit"] },
};
diff --git a/src/server/mixed-media.ts b/src/server/mixed-media.ts
index 810990c8..8e285ec2 100644
--- a/src/server/mixed-media.ts
+++ b/src/server/mixed-media.ts
@@ -10,6 +10,7 @@ import {
MIXED_FEATURE,
MIXED_FRAME_FEATURE,
MIXED_FRAME_MODELS,
+ MIXED_FRAME_MOVES,
MIXED_MODELS,
MIXED_MODES,
MIXED_OPEN_LEGACY,
@@ -108,12 +109,16 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
const problem = mixedRangeProblem(body.range, duration, sourceFps);
if (problem) throw new ShortsError(problem);
const fps = clampFps(body.fps, sourceFps);
+ // A frame model Per frame has moved on from runs on its successor, and says so.
+ const movedFrom = body.modelId && MIXED_FRAME_MOVES[body.modelId] ? body.modelId : undefined;
+ if (movedFrom) body = { ...body, modelId: MIXED_FRAME_MOVES[movedFrom] };
const mode = renderMode(body);
const choices = modeModels(body.engine, mode);
const modelId = body.modelId && choices.includes(body.modelId) ? body.modelId : choices[0];
const model = getModel(modelId);
const len = body.range.end - body.range.start;
const notes: string[] = [];
+ if (movedFrom && modelId === body.modelId) notes.push(`${getModel(movedFrom)?.name ?? movedFrom} is now ${model?.name ?? modelId} here`);
let frames = mixedFrames(len, fps);
let rate = fps;
const size = info.width && info.height ? { width: info.width, height: info.height } : body.source.width && body.source.height ? { width: body.source.width, height: body.source.height } : undefined;
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index fea4b080..198af764 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -1439,6 +1439,19 @@ export async function prepareWorkflow(endpointTemplate: string, input: GenInput,
if (b.channels) values.channels = dbsChannelsFor(extra.channels, sourceChannels);
for (const k of ["separationModel", "channels", "sourceChannels"]) delete extra[k];
for (const [k, v] of Object.entries(extra)) values[k as BindingKey] = v;
+ // SeedVR2's `scale` multiplies the picture before one diffusion pass over all of it, and its graph is made for up to
+ // limits.maxWidth × maxHeight: the multiplier comes down to fit the picture (a 3000 × 2000 photo at the template's 4x
+ // would ask for 12000 × 8000), to the resize node's 0.01 step.
+ if (manifest.id === "upscale-image-seedvr2" && b.scale) {
+ const src = ctx.media?.(String(values.image ?? ""));
+ if (src?.width && src.height) {
+ const [maxW, maxH] = [Number(manifest.limits?.maxWidth ?? Infinity), Number(manifest.limits?.maxHeight ?? Infinity)];
+ const room = Math.min(maxW / src.width, maxH / src.height);
+ const asked = Number(values.scale ?? d.scale ?? 1);
+ if (room < 1) throw new ProviderError(`SeedVR2 makes pictures up to ${maxW} × ${maxH} px on your GPU, and this one is already ${src.width} × ${src.height}: pick 4x ESRGAN for it`, 400);
+ if (asked > room) values.scale = Math.floor(room * 100) / 100;
+ }
+ }
// A canvas the request names (a layout's, Soul's exact sizes) stays on the graph's grid and inside its limits, as the
// cloud fits the same canvas (FieldMap.size): both engines render one size, the size a layout is compiled at.
if (b.width && b.height && (extra.width !== undefined || extra.height !== undefined)) {
diff --git a/tests/image-studios.test.ts b/tests/image-studios.test.ts
index 561a7b9e..ec2981ea 100644
--- a/tests/image-studios.test.ts
+++ b/tests/image-studios.test.ts
@@ -518,6 +518,28 @@ describe("Photodump packs and planning", () => {
[selfie.url, "/api/files/uploads/a.png"],
[selfie.url, "/api/files/uploads/b.png"],
]);
+ expect(custom.requests[0].prompt).toMatch(/^The person in image 1 recreated in image 2: .*Replace the person in image 2 with them/);
+ // Krea 2 Identity Edit reads the scene first and the person last (its likeness boost is on the last picture).
+ const krea = planPhotodump({ pack: mine, subject: selfie, engine: "open", modelId: "oss-krea2-identity-edit" }, {});
+ expect(krea.modelId).toBe("oss-krea2-identity-edit");
+ expect(krea.requests.map((r) => r.inputs?.images)).toEqual([
+ ["/api/files/uploads/a.png", selfie.url],
+ ["/api/files/uploads/b.png", selfie.url],
+ ]);
+ expect(krea.requests[0].prompt).toMatch(/^The person in image 2 recreated in image 1: .*Replace the person in image 1 with them/);
+ // A pack of Fuobe's own has only the selfie: image 1 on every model.
+ const kreaOwn = planPhotodump({ pack, subject: selfie, engine: "open", modelId: "oss-krea2-identity-edit" }, {});
+ expect(kreaOwn.requests[0].inputs?.images).toEqual([selfie.url]);
+ expect(kreaOwn.requests[0].prompt).toContain("the person in image 1");
+ // A saved character goes in as one photo of theirs (two pictures would read as two people), after a pack's reference.
+ const kreaMaya = planPhotodump({ pack, subject: maya, engine: "open", modelId: "oss-krea2-identity-edit" }, {});
+ expect(kreaMaya.requests[0].inputs?.images).toEqual(["/api/files/uploads/m1.png"]);
+ expect(kreaMaya.requests[0].prompt).not.toContain("@Maya");
+ const kreaMayaMine = planPhotodump({ pack: mine, subject: maya, engine: "open", modelId: "oss-krea2-identity-edit" }, {});
+ expect(kreaMayaMine.requests[0].inputs?.images).toEqual(["/api/files/uploads/a.png", "/api/files/uploads/m1.png"]);
+ expect(kreaMayaMine.requests[0].prompt).toMatch(/^The person in image 2 recreated in image 1: /);
+ // Other models still @mention the character (the server attaches their photos or Soul ID).
+ expect(planPhotodump({ pack, subject: maya, engine: "open" }, {}).requests[0].prompt).toContain("@Maya");
expect(() => planPhotodump({ pack, subject: { ...maya, references: [] }, engine: "cloud" }, {})).toThrow(/Add a photo of Maya/);
});
@@ -623,13 +645,15 @@ describe("Fashion Factory", () => {
expect(fashionPhotosetRequests(t, "/api/files/dressed.png", "open", "oss-krea2-identity-edit")[0].modelId).toBe("oss-krea2-identity-edit");
// A pick the step no longer lists falls back to its first model.
expect(fashionPhotosetRequests(t, "/api/files/dressed.png", "open", "oss-qwen-edit")[0].modelId).toBe("oss-qwen-image-21");
- // When the try-on can't run on your GPU: Qwen-Image 2.1 Turbo, then Krea 2 Identity Edit, both dressing from image 2.
- expect(FASHION_MODELS.outfit.open).toEqual(["fuobe-tryon", "oss-qwen-image-21-turbo", "oss-krea2-identity-edit"]);
+ // When the try-on can't run on your GPU: Qwen-Image 2.1 Turbo, then Qwen-Image 2.1, both dressing from image 2. Krea 2
+ // Identity Edit makes the photoset only: it takes a second picture as a person, and the outfit step's is a garment.
+ expect(FASHION_MODELS.outfit.open).toEqual(["fuobe-tryon", "oss-qwen-image-21-turbo", "oss-qwen-image-21"]);
expect(FASHION_MODELS.photoset.open).toEqual(["oss-qwen-image-21", "oss-krea2-identity-edit"]);
expect(fashionOutfitRequest(t, "/api/files/base.png", "/api/files/shirt.png", "open", undefined, { has: (id) => id !== "fuobe-tryon" }).modelId).toBe("oss-qwen-image-21-turbo");
- const dressed = fashionOutfitRequest(t, "/api/files/base.png", "/api/files/shirt.png", "open", "oss-krea2-identity-edit");
- expect(dressed).toMatchObject({ modelId: "oss-krea2-identity-edit", op: "edit", inputs: { images: ["/api/files/base.png", "/api/files/shirt.png"] } });
+ const dressed = fashionOutfitRequest(t, "/api/files/base.png", "/api/files/shirt.png", "open", "oss-qwen-image-21");
+ expect(dressed).toMatchObject({ modelId: "oss-qwen-image-21", op: "edit", inputs: { images: ["/api/files/base.png", "/api/files/shirt.png"] } });
expect(() => plan(dressed)).not.toThrow();
+ expect(fashionOutfitRequest(t, "b", "g", "open", "oss-krea2-identity-edit").modelId).toBe("fuobe-tryon");
});
it("walks the wizard with Higgsfield's validation messages", () => {
@@ -677,9 +701,7 @@ describe("apps on the newer tools", () => {
// Kling Avatar 2.0 takes what Kling AI Avatar took: the portrait and the voice.
const map = (id: string) => getModel(id)!.routes.find((r) => r.op === "avatar")!.map;
expect(map("kling-avatar-2")).toEqual(map("kling-avatar"));
- expect(getPreset("app-asmr-classic")!.parity).toBe(
- "MiniMax H3 makes its own sound; Kling 2.5 Turbo and Wan 2.2 clips are silent — add sound to them with the Audio → Video to audio tool",
- );
+ expect(getPreset("app-asmr-classic")!.parity).toBe("This makes a silent clip. Add sound with Video to audio.");
});
});
diff --git a/tests/layers-api.test.ts b/tests/layers-api.test.ts
index fe846f5e..279c286c 100644
--- a/tests/layers-api.test.ts
+++ b/tests/layers-api.test.ts
@@ -158,7 +158,7 @@ describe("job steps", () => {
inputs: { images: ["/api/files/a.png"], mask: "/api/files/m.png", sketch: "/api/files/s.png" },
});
expect(steps({ ...paint, modelId: "bria-fibo-2" })[0].request).toMatchObject({ modelId: "bria-fibo-2", op: "inpaint", inputs: { mask: "/api/files/m.png" } });
- expect(steps({ ...paint, engine: "open", modelId: "oss-krea2-inpaint" })[0].request).toMatchObject({ modelId: "oss-krea2-inpaint", op: "inpaint", inputs: { mask: "/api/files/m.png" } });
+ expect(steps({ ...paint, engine: "open", modelId: "oss-flux-fill" })[0].request).toMatchObject({ modelId: "oss-flux-fill", op: "inpaint", inputs: { mask: "/api/files/m.png" } });
const open = steps({ ...paint, engine: "open", settings: { keepAlpha: true } });
expect(open.map((x) => [x.key, x.request.modelId, x.request.op])).toEqual([
["inpaint", "oss-qwen-image-21", "inpaint"],
@@ -214,9 +214,9 @@ describe("job steps", () => {
expect(turned.loras).toBeUndefined();
const expand = steps({ tool: "expand", engine: "open", settings: { pads: { left: 64, top: 0, right: 64, bottom: 8 } } })[0].request;
expect(expand).toMatchObject({ modelId: "oss-qwen-image-21", op: "outpaint", params: { extra: { padLeft: 64, padTop: 0, padRight: 64, padBottom: 8 } } });
- // Krea 2 Inpaint grows the canvas from the same pads.
- expect(steps({ tool: "expand", engine: "open", modelId: "oss-krea2-inpaint", settings: { pads: { left: 64, top: 0, right: 64, bottom: 8 } } })[0].request).toMatchObject({
- modelId: "oss-krea2-inpaint",
+ // FLUX.1 Fill grows the canvas from the same pads.
+ expect(steps({ tool: "expand", engine: "open", modelId: "oss-flux-fill", settings: { pads: { left: 64, top: 0, right: 64, bottom: 8 } } })[0].request).toMatchObject({
+ modelId: "oss-flux-fill",
op: "outpaint",
params: { extra: { padLeft: 64 } },
});
@@ -224,12 +224,14 @@ describe("job steps", () => {
expect(steps({ tool: "expand" })[0].request.prompt).toMatch(/^Fill the empty grey margins/);
expect(steps({ tool: "expand" })[0].request.prompt).toMatch(/fill the margins with more of the same surroundings\.$/);
expect(steps({ tool: "regional", prompt: "add a hat" })[0].request).toMatchObject({ modelId: "seedream-5-pro", op: "edit" });
- // Regional edit and Layer edit on your GPU: Qwen-Image 2.1 first, then Krea 2 Edit and FIBO 2 Edit Turbo, one picture each.
+ // Regional edit on your GPU: Qwen-Image 2.1 first, then Krea 2 Edit and FIBO 2 Edit Turbo, one picture each. Layer edit
+ // takes FIBO 2 Edit Turbo too, with its references.
expect(steps({ tool: "regional", engine: "open", prompt: "add a hat" })[0].request).toMatchObject({ modelId: "oss-qwen-image-21", op: "edit" });
for (const modelId of ["oss-krea2-edit", "oss-fibo2-edit-turbo"]) {
expect(steps({ tool: "regional", engine: "open", modelId, prompt: "add a hat" })[0].request).toMatchObject({ modelId, op: "edit", inputs: { images: ["/api/files/a.png"] } });
- expect(steps({ tool: "regenerate", engine: "open", modelId, prompt: "a red coat" })[0].request).toMatchObject({ modelId, op: "edit" });
}
+ expect(steps({ tool: "regenerate", engine: "open", modelId: "oss-fibo2-edit-turbo", prompt: "a red coat" })[0].request).toMatchObject({ modelId: "oss-fibo2-edit-turbo", op: "edit" });
+ expect(() => steps({ tool: "regenerate", engine: "open", modelId: "oss-krea2-edit", prompt: "a red coat" })).toThrow(/can't run this tool/);
expect(() => steps({ tool: "regional", engine: "open", modelId: "oss-qwen-edit", prompt: "add a hat" })).toThrow(/can't run this tool/);
expect(steps({ tool: "generate-layer", engine: "open", modelId: "oss-moss-image", prompt: "a lamp" })[0].request).toMatchObject({ modelId: "oss-moss-image", op: "t2i" });
});
diff --git a/tests/layers-comfy.test.ts b/tests/layers-comfy.test.ts
index a7f791a4..41288b05 100644
--- a/tests/layers-comfy.test.ts
+++ b/tests/layers-comfy.test.ts
@@ -5,6 +5,7 @@ import { afterAll, describe, expect, it } from "vitest";
import type { ManifestWorkflow } from "@/lib/comfy";
import type { GenerationRequest } from "@/lib/catalog/types";
import type { LayerJobInput } from "@/lib/layers";
+import type { MediaInfo } from "@/lib/media-probe";
// The Layers tools' open-engine requests, bound into the real library graphs: extras bind by name and
// silently fall back to defaults when a name is wrong, so check the values land where they should.
@@ -18,13 +19,15 @@ const { getModel } = await import("@/lib/catalog");
afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
-async function bind(req: GenerationRequest) {
+/** The request bound into its graph; `size` is what the server read of the picture it sent (its width and height). */
+async function bind(req: GenerationRequest, size?: { width: number; height: number }) {
const route = getModel(req.modelId)!.routes.find((r) => r.op === req.op)!;
expect(route.provider).toBe("comfyui");
+ const media = (name: unknown): MediaInfo | undefined => (size && name === req.inputs?.images?.[0] ? { container: "image", ...size, hasVideo: false, hasAudio: false } : undefined);
const res = await prepareWorkflow(
route.endpoint,
{ prompt: req.prompt, images: req.inputs?.images, ...(req.inputs?.mask ? { mask: req.inputs.mask } : {}), ...req.params },
- { generationId: "gen1", op: req.op!, upload: async (_d, _t, name) => `up_${name}`, media: () => undefined, serverRam: async () => undefined },
+ { generationId: "gen1", op: req.op!, upload: async (_d, _t, name) => `up_${name}`, media, serverRam: async () => undefined },
);
const wf = res.workflow as Record<string, { inputs: Record<string, unknown> }>;
const m = res.manifest as ManifestWorkflow;
@@ -66,14 +69,14 @@ describe("Layers on the open engine", () => {
expect(at("numLayers")).toEqual([2]);
});
- it("expand: the padding reaches both of Qwen-Image 2.1's pad nodes, or Krea 2 Inpaint's when picked", async () => {
+ it("expand: the padding reaches both of Qwen-Image 2.1's pad nodes, or FLUX Fill when picked", async () => {
const pads = { pads: { left: 64, top: 0, right: 128, bottom: 8 } };
const at = await bind(step({ tool: "expand", settings: pads }));
expect([at("padLeft"), at("padTop"), at("padRight"), at("padBottom")]).toEqual([[64, 64], [0, 0], [128, 128], [8, 8]]);
// The words only say what fills the margins: the graph keeps the picture itself.
expect(at("prompt")).toEqual(["Continue the scene naturally beyond every edge with matching perspective, lighting, textures and grain."]);
- const krea = await bind(step({ tool: "expand", modelId: "oss-krea2-inpaint", settings: pads }));
- expect([krea("padLeft")[0], krea("padTop")[0], krea("padRight")[0], krea("padBottom")[0]]).toEqual([64, 0, 128, 8]);
+ const fill = await bind(step({ tool: "expand", modelId: "oss-flux-fill", settings: pads }));
+ expect([fill("padLeft"), fill("padTop"), fill("padRight"), fill("padBottom")]).toEqual([[64], [0], [128], [8]]);
});
it("relight and edit text: the instruction reaches the edit graphs", async () => {
@@ -106,6 +109,22 @@ describe("Inpaint and Enhancer on the open engine", () => {
const esrgan = await bind(step({ tool: "enhance", modelId: "oss-upscale-image", settings: { look: "detail" } }));
expect(esrgan("scale")).toEqual([0.5]);
});
+
+ it("upscale: SeedVR2's multiplier keeps the picture inside its graph's 4096 px", async () => {
+ const up = step({ tool: "upscale" });
+ expect(up).toMatchObject({ modelId: "oss-seedvr2-image", op: "upscale-image" });
+ // The template's 4x while it fits: 1024 → 4096.
+ expect((await bind(up, { width: 1024, height: 768 }))("scale")).toEqual([4]);
+ // A 3000 × 2000 photo: 4096 / 3000, to the resize node's 0.01 step (4095 px), not 12000 px.
+ expect((await bind(up, { width: 3000, height: 2000 }))("scale")).toEqual([1.36]);
+ // The Enhancer's 2x on a 3000 px layer comes down the same way; a smaller ask stays as it is.
+ expect((await bind(step({ tool: "enhance", settings: { look: "detail" } }), { width: 3000, height: 1000 }))("scale")).toEqual([1.36]);
+ expect((await bind(step({ tool: "enhance", settings: { look: "detail" } }), { width: 1500, height: 1000 }))("scale")).toEqual([2]);
+ // A picture already past it has no room to grow, and says which upscaler takes it.
+ await expect(bind(up, { width: 5000, height: 3000 })).rejects.toThrow(/up to 4096 × 4096 px on your GPU, and this one is already 5000 × 3000: pick 4x ESRGAN/);
+ // 4x ESRGAN is not capped here (its scale resizes after the model's own 4x).
+ expect((await bind(step({ tool: "upscale", modelId: "oss-upscale-image" }), { width: 3000, height: 2000 }))("scale")).toEqual([1]);
+ });
});
describe("Text detection on the open engine (ocr-lines-qwen35)", () => {
diff --git a/tests/layers.test.ts b/tests/layers.test.ts
index a4e88d06..fbc2973f 100644
--- a/tests/layers.test.ts
+++ b/tests/layers.test.ts
@@ -4,6 +4,7 @@ import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { getModel, supportsOp } from "@/lib/catalog";
+import { imageLimit } from "@/lib/catalog/plan";
import type { Operation } from "@/lib/catalog/types";
import { layersHref } from "@/lib/output-actions";
import {
@@ -565,7 +566,7 @@ describe("tools and prices", () => {
});
it("puts the newest open image models first: Qwen-Image 2.1, its Turbo, Krea 2, FIBO 2, MOSS-Image and SeedVR2", () => {
- expect(TOOL_MODELS.regenerate.open).toEqual(["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit", "oss-fibo2-edit-turbo"]);
+ expect(TOOL_MODELS.regenerate.open).toEqual(["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-fibo2-edit-turbo"]);
expect(TOOL_MODELS.regenerate.cloud).toEqual(["nano-banana-pro", "seedream-5-pro", "nano-banana-2-1"]);
expect(TOOL_MODELS["generate-layer"].open).toEqual(["oss-qwen-image-21", "oss-ideogram-4", "oss-krea2-turbo", "oss-moss-image"]);
expect(TOOL_MODELS["text-edit"].open).toEqual(["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit"]);
@@ -574,24 +575,46 @@ describe("tools and prices", () => {
expect(TOOL_MODELS.upscale.open).toEqual(["oss-seedvr2-image", "oss-upscale-image"]);
expect(TOOL_MODELS.relight).toEqual({ cloud: ["nano-banana-pro", "nano-banana-2-1"], open: ["oss-qwen-image-21-turbo", "oss-krea2-edit", "oss-qwen-relight"] });
expect(TOOL_MODELS.angles.open).toEqual(["oss-qwen-image-21"]);
- expect(TOOL_MODELS.expand.open).toEqual(["oss-qwen-image-21", "oss-krea2-inpaint"]);
- expect(TOOL_MODELS.inpaint).toEqual({ cloud: ["nano-banana-pro", "bria-fibo-2", "z-image-inpaint"], open: ["oss-qwen-image-21", "oss-krea2-inpaint"] });
- // Qwen-Image-Edit 2511, FLUX.1 Kontext and Fill, Z-Image Turbo, Qwen-Image 2512 and Nano Banana 2 are in no tool list.
+ // FLUX.1 Fill stays the second Inpaint and Expand model on your GPU: it keeps the picture's size and its pixels outside
+ // the mask, and its graph runs on core ComfyUI.
+ expect(TOOL_MODELS.expand.open).toEqual(["oss-qwen-image-21", "oss-flux-fill"]);
+ expect(TOOL_MODELS.inpaint).toEqual({ cloud: ["nano-banana-pro", "bria-fibo-2", "z-image-inpaint"], open: ["oss-qwen-image-21", "oss-flux-fill"] });
+ // Qwen-Image-Edit 2511, FLUX.1 Kontext, FLUX.1 Fill pro, Z-Image Turbo, Qwen-Image 2512 and Nano Banana 2 are in no tool
+ // list; nor is Krea 2 Inpaint, which redraws the whole picture at about 1 MP.
const all = Object.values(TOOL_MODELS).flatMap((t) => [...t.cloud, ...t.open]);
- for (const id of ["oss-qwen-edit", "oss-flux-kontext", "oss-flux-fill", "flux-fill-pro", "oss-z-image-turbo", "oss-qwen-image", "nano-banana-2"]) expect(all, id).not.toContain(id);
+ for (const id of ["oss-qwen-edit", "oss-flux-kontext", "flux-fill-pro", "oss-z-image-turbo", "oss-qwen-image", "nano-banana-2", "oss-krea2-inpaint"]) expect(all, id).not.toContain(id);
// The angle and the front of a turn need the 25-step model (its Turbo misses big camera turns).
expect(getModel("oss-qwen-image-21")!.routes.find((r) => r.op === "edit")!.endpoint).toBe("qwen-image-21-edit");
});
it("only offers models whose route takes what the tool sends", () => {
- // Regional edit, edit text and the Enhancer send one picture to an edit route.
- for (const tool of ["regional", "text-edit", "enhance", "relight"] as const) {
+ // Regional edit, edit text, the Enhancer and Relight send one picture to an edit route: on your GPU its graph binds it.
+ const manifest = JSON.parse(fs.readFileSync(path.join(process.cwd(), "workflows/comfyui/manifest.json"), "utf8")) as { workflows: { id: string; bindings: Record<string, unknown> }[] };
+ const graph = (id: string, op: Operation) => {
+ const route = getModel(id)!.routes.find((r) => r.op === op);
+ return route?.provider === "comfyui" ? manifest.workflows.find((w) => w.id === route.endpoint) : undefined;
+ };
+ for (const tool of ["regional", "text-edit", "enhance", "relight", "regenerate"] as const) {
for (const id of TOOL_MODELS[tool].open) {
- const m = getModel(id)!;
- expect(supportsOp(m, "edit"), `${tool}: ${id}`).toBe(true);
- expect(m.options.maxImages ?? 1, `${tool}: ${id}`).toBeGreaterThanOrEqual(1);
+ expect(supportsOp(getModel(id)!, "edit"), `${tool}: ${id}`).toBe(true);
+ expect(graph(id, "edit")?.bindings.image, `${tool}: ${id}`).toBeDefined();
}
}
+ // Layer edit sends the layer and up to 3 references (the API's limit): every model takes all 4, on both engines.
+ for (const engine of ["cloud", "open"] as const) {
+ for (const id of TOOL_MODELS.regenerate[engine]) expect(imageLimit(getModel(id)!, "edit"), `regenerate: ${id}`).toBeGreaterThanOrEqual(4);
+ }
+ // Open Inpaint and Expand keep a choice that runs on core ComfyUI alone (FLUX.1 Fill pastes the picture back around the
+ // mask), and none needs the Krea 2 Ostris Edit add-on.
+ const nodes = (id: string, op: Operation) =>
+ (manifest.workflows.find((w) => w.id === getModel(id)!.routes.find((r) => r.op === op)?.endpoint) as { customNodes?: { name: string }[] } | undefined)?.customNodes?.map((n) => n.name) ?? [];
+ for (const [tool, op] of [["inpaint", "inpaint"], ["expand", "outpaint"]] as const) {
+ expect(TOOL_MODELS[tool].open.some((id) => !nodes(id, op).length), tool).toBe(true);
+ for (const id of TOOL_MODELS[tool].open) expect(nodes(id, op), `${tool}: ${id}`).not.toContain("ComfyUI-Krea2-Ostris-Edit");
+ }
+ // Inpaint's mask and Expand's four margins reach the open graphs.
+ for (const id of TOOL_MODELS.inpaint.open) expect(graph(id, "inpaint")?.bindings.mask, id).toBeDefined();
+ for (const id of TOOL_MODELS.expand.open) expect(Object.keys(graph(id, "outpaint")?.bindings ?? {}), id).toEqual(expect.arrayContaining(["image", "padLeft", "padTop", "padRight", "padBottom"]));
// Inpaint sends a mask: every model past Nano Banana Pro (the red-tinted copy) has an inpaint route with one.
for (const engine of ["cloud", "open"] as const) {
for (const id of TOOL_MODELS.inpaint[engine].filter((x) => x !== "nano-banana-pro")) {
diff --git a/tests/open-sota-studios.test.ts b/tests/open-sota-studios.test.ts
index 06d3037b..bc3788cb 100644
--- a/tests/open-sota-studios.test.ts
+++ b/tests/open-sota-studios.test.ts
@@ -122,7 +122,7 @@ describe("apps and tools pick the new models first", () => {
});
it("Layers: Qwen-Image 2.1 edits, inpaints, expands and makes a layer first; Ideogram 4 is the next pick for a layer", () => {
- expect(TOOL_MODELS.regenerate.open).toEqual(["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-krea2-edit", "oss-fibo2-edit-turbo"]);
+ expect(TOOL_MODELS.regenerate.open).toEqual(["oss-qwen-image-21", "oss-qwen-image-21-turbo", "oss-fibo2-edit-turbo"]);
// A lone object on a plain background is what Ideogram 4's safety filter answers with a grey card most often.
expect(TOOL_MODELS["generate-layer"].open).toEqual(["oss-qwen-image-21", "oss-ideogram-4", "oss-krea2-turbo", "oss-moss-image"]);
for (const tool of ["text-edit", "regional", "expand", "inpaint", "enhance"] as const) expect(TOOL_MODELS[tool].open[0], tool).toBe("oss-qwen-image-21");
@@ -150,12 +150,12 @@ describe("apps and tools pick the new models first", () => {
expect(EFFECT_CHAIN_MODELS.edit).toEqual({ cloud: "qwen-image-edit-2511-cloud", open: "oss-qwen-image-21-turbo" });
});
- it("Photodump, Fashion Factory and Character swap offer Qwen-Image 2.1 first, then Krea 2 Identity Edit", () => {
+ it("Photodump, Fashion Factory's photoset and Character swap offer Qwen-Image 2.1 first, then Krea 2 Identity Edit", () => {
const selfie: PhotoSubject = { kind: "selfie", url: "/api/files/uploads/me.png" };
expect(PHOTODUMP_MODELS.open).toEqual(["fuobe-soul", "oss-qwen-image-21", "oss-krea2-identity-edit", "oss-qwen-image-21-turbo"]);
expect(photodumpModel(selfie, "open", {}).modelId).toBe("oss-qwen-image-21");
expect(photodumpModel(selfie, "open", {}, "oss-krea2-identity-edit").modelId).toBe("oss-krea2-identity-edit");
- expect(FASHION_MODELS.outfit.open).toEqual(["fuobe-tryon", "oss-qwen-image-21-turbo", "oss-krea2-identity-edit"]);
+ expect(FASHION_MODELS.outfit.open).toEqual(["fuobe-tryon", "oss-qwen-image-21-turbo", "oss-qwen-image-21"]);
expect(fashionModel("photoset", "open")).toBe("oss-qwen-image-21");
expect(ANCHOR_MODELS.open.map((m) => m.id)).toEqual(["oss-qwen-image-21", "oss-krea2-identity-edit"]);
expect(anchorModel("open").id).toBe("oss-qwen-image-21");
@@ -165,7 +165,7 @@ describe("apps and tools pick the new models first", () => {
});
});
-describe("app runs stored before the apps moved to Qwen-Image 2.1", () => {
+describe("app runs stored before the apps moved to newer models", () => {
const stored = (modelId: string, presetId: string, op?: GenerationRequest["op"]): GenerationRequest => ({
feature: "app",
modelId,
@@ -189,6 +189,21 @@ describe("app runs stored before the apps moved to Qwen-Image 2.1", () => {
}
});
+ it("a talking app's run on Kling AI Avatar and an Upscale run on 4x ESRGAN run on the app's model now", () => {
+ const talk = (presetId: string) => ({ ...stored("kling-avatar", presetId, "avatar"), inputs: { images: ["/api/files/uploads/me.png"], audio: "/api/files/uploads/voice.mp3" } });
+ expect(() => planGeneration(talk("app-talking-photo"), getModel, getPreset)).toThrow(/runs on kling-avatar-2/);
+ for (const id of ["app-talking-photo", "app-asmr-host", "app-asmr-promo"]) {
+ const moved = movedAppRequest(talk(id), getModel, getPreset);
+ expect(moved.request, id).toMatchObject({ modelId: "kling-avatar-2", op: "avatar", presetId: id });
+ expect(moved.note, id).toMatch(/now runs on Kling Avatar 2\.0$/);
+ expect(planGeneration(moved.request, getModel, getPreset), id).toMatchObject({ op: "avatar", model: { id: "kling-avatar-2" } });
+ }
+ const up = movedAppRequest(stored("oss-upscale-image", "app-upscale", "upscale-image"), getModel, getPreset);
+ expect(up.request).toMatchObject({ modelId: "oss-seedvr2-image", op: "upscale-image" });
+ expect(up.note).toBe("Upscale now runs on SeedVR2 (image)");
+ expect(planGeneration(up.request, getModel, getPreset)).toMatchObject({ op: "upscale-image", model: { id: "oss-seedvr2-image" } });
+ });
+
it("leaves alone an app a LoRA ties to the old model, a model the app never ran on, and a request without an app", () => {
const angles = stored("oss-qwen-edit", "app-angles", "edit");
expect(movedAppRequest(angles, getModel, getPreset)).toEqual({ request: angles });
diff --git a/tests/originals-marketing.test.ts b/tests/originals-marketing.test.ts
index e2618147..a1d43dcb 100644
--- a/tests/originals-marketing.test.ts
+++ b/tests/originals-marketing.test.ts
@@ -303,8 +303,8 @@ describe("Fuobe Try-On's LoRA is never left out of a run", () => {
describe("Fashion Factory moves on when a model can't run", () => {
const t = getTemplate("red-room")!;
- it("offers Qwen-Image 2.1 Turbo and Krea 2 Identity Edit after Fuobe Try-On on your GPU and takes the photoset's pick", () => {
- expect(FASHION_MODELS.outfit.open).toEqual([TRYON_MODEL, "oss-qwen-image-21-turbo", "oss-krea2-identity-edit"]);
+ it("offers Qwen-Image 2.1 Turbo and Qwen-Image 2.1 after Fuobe Try-On on your GPU and takes the photoset's pick", () => {
+ expect(FASHION_MODELS.outfit.open).toEqual([TRYON_MODEL, "oss-qwen-image-21-turbo", "oss-qwen-image-21"]);
const qwen = fashionOutfitRequest(t, "/b.png", "/g.png", "open", "oss-qwen-image-21-turbo");
expect(qwen).toMatchObject({ modelId: "oss-qwen-image-21-turbo", params: { aspectRatio: "3:4" } });
expect(qwen.prompt).toMatch(/^Dress the person in image 1/);
diff --git a/tests/person-remove-h3.test.ts b/tests/person-remove-h3.test.ts
index 9bbbe133..2b2e45e5 100644
--- a/tests/person-remove-h3.test.ts
+++ b/tests/person-remove-h3.test.ts
@@ -113,17 +113,24 @@ describe("H3 person removal: the graph", () => {
await expect(prepare({ prompt: "" })).rejects.toThrow(/Say what to remove/);
});
- it("the clean frame keeps the part's framing: Qwen-Image 2.1 follows image 1's shape, the relay centre-crops it back", () => {
- const qwen = JSON.parse(fs.readFileSync(path.join(__dirname, "../workflows/comfyui/qwen-image-21-edit.json"), "utf8")) as Graph;
- // Image 1 is scaled to 2048 px on its long side, and the latent is made on its own size (resolution 0), rounded to 32.
- expect(qwen["20"]).toMatchObject({ class_type: "ImageScaleToMaxDimension", inputs: { image: ["10", 0], largest_size: 2048 } });
- expect(qwen["30"]).toMatchObject({ class_type: "TextEncodeQwenImage21", inputs: { resolution: 0 } });
- // A 16:9 part: 1344×736 → 2048×1121.5 → 2048×1120, the same shape within a pixel at the part's size.
- const part = h3Canvas(1280, 720, "768p");
- const long = 2048;
- const short = Math.round(((part.height * long) / part.width) / 32) * 32;
- expect([long, short]).toEqual([2048, 1120]);
- expect(Math.abs(part.height - (short * part.width) / long)).toBeLessThanOrEqual(1);
+ it("the clean frame keeps the part's framing: Qwen-Image 2.1 follows image 1's shape, the relay centre-crops it back", async () => {
+ // The planned clean step, bound into its graph with the frame the plan chains in.
+ const clean = planRemoval(input()).steps.find((s) => s.key === "clean")!.request;
+ const route = getModel(clean.modelId)!.routes.find((r) => r.op === clean.op)!;
+ const bound = (await prepareWorkflow(route.endpoint, { prompt: clean.prompt, images: ["frame.png"], ...clean.params } as GenInput, {
+ generationId: "g2",
+ op: clean.op!,
+ upload: async (_d, _t, name) => `up_${name}`,
+ media: (n) => (n === "frame.png" ? { container: "image", width: 1344, height: 736, hasVideo: false, hasAudio: false } : undefined),
+ })).workflow as Graph;
+ // Image 1 is the frame, scaled to 2048 px on its long side, and the latent is made on its own shape (resolution 0):
+ // nothing in the request sets a canvas of its own.
+ expect(bound["10"]).toMatchObject({ class_type: "LoadImage", inputs: { image: "frame.png" } });
+ expect(bound["20"]).toMatchObject({ class_type: "ImageScaleToMaxDimension", inputs: { image: ["10", 0], largest_size: 2048 } });
+ expect(bound["30"]).toMatchObject({ class_type: "TextEncodeQwenImage21", inputs: { resolution: 0 } });
+ // The relay fits the clean frame back to the part's exact size from its centre.
+ const relay = await prepare({ prompt: "the man in the grey shirt" });
+ expect(relay.anchor_fit).toMatchObject({ class_type: "ImageScale", inputs: { image: ["anchor", 0], width: ["dimensions", 0], height: ["dimensions", 1], crop: "center" } });
});
it("downloads the Person Remover LoRA before it runs", () => {
diff --git a/tests/shorts-api.test.ts b/tests/shorts-api.test.ts
index bd618242..8d1ea892 100644
--- a/tests/shorts-api.test.ts
+++ b/tests/shorts-api.test.ts
@@ -486,6 +486,10 @@ describe("Mixed Media renders", () => {
const per = getModel("nano-banana-2-1")!.pricing!.usd;
expect(est).toMatchObject({ mode: "frames", frames: 75, fps: 7.5, perFrameUsd: per, demo: false, previewUsd: per });
expect(est.notes).toContain("Frames are every 4th frame of this 30 FPS clip: 7.5 FPS, 75 frames");
+ // A render that names Nano Banana 2 (a saved setup, an API caller) runs on Nano Banana 2.1, not the Original.
+ const older = await mixed.estimateMixed(mm({ engine: "cloud", modelId: "nano-banana-2", source: { url: "/api/files/placeholder.mp4", duration: 12, fps: 30 }, range: { start: 0, end: 10 }, fps: 8 }) as never);
+ expect(older).toMatchObject({ mode: "frames", modelId: "nano-banana-2-1", perFrameUsd: per });
+ expect(older.notes).toContain(`${getModel("nano-banana-2")!.name} is now ${getModel("nano-banana-2-1")!.name} here`);
// 75 frames × the frame price, plus the cut, the extraction and the assembly (fal compute, about free).
expect(est.costUsd).toBeGreaterThanOrEqual(75 * per);
expect(est.costUsd).toBeLessThan(75 * per + 0.01);