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.

Studios: a link's model still lands when the composer moves Ideogram 4 to its stand-in

Adarsh6a188d3c31a3
diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsx
index 73b4c111..02bc4bf8 100644
--- a/src/components/studio/studio-page.tsx
+++ b/src/components/studio/studio-page.tsx
@@ -526,7 +526,7 @@ function StudioDraft({ config, header, tabs, initialRefs, initialPrompt }: Draft
};
// 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 follow = (base: Draft, current: Draft) => followEngineDefault(base, current, config.defaultModels, engine, config.uncaptioned);
const buildRef = useRef(build);
const adoptRef = useRef(adopt);
const followRef = useRef(follow);
diff --git a/src/lib/composer.ts b/src/lib/composer.ts
index 733fcb54..0f636b5b 100644
--- a/src/lib/composer.ts
+++ b/src/lib/composer.ts
@@ -800,12 +800,20 @@ export function prestepCost(preset: Pick<Preset, "type" | "open" | "cloud" | "pr
/**
* 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).
+ * default (or that default's stand-in where the server writes no caption: `standIns`, the studio's uncaptioned). 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), or the stand-in (Qwen-Image 2.1).
*/
-export function followEngineDefault<D extends DraftShape>(base: D, current: D, defaults: Partial<Record<Engine, string>>, engine: Engine): D {
+export function followEngineDefault<D extends DraftShape>(
+ base: D,
+ current: D,
+ defaults: Partial<Record<Engine, string>>,
+ engine: Engine,
+ standIns: Partial<Record<Engine, string>> = {},
+): D {
const own = Object.values(defaults).filter(Boolean);
- if (current.modelId === base.modelId || !own.includes(base.modelId) || current.modelId !== defaults[engine]) return base;
+ const swapped = current.modelId === defaults[engine] || (!!standIns[engine] && current.modelId === standIns[engine]);
+ if (current.modelId === base.modelId || !own.includes(base.modelId) || !swapped) return base;
return { ...base, modelId: current.modelId, params: current.params };
}
diff --git a/tests/soul-fixes.test.ts b/tests/soul-fixes.test.ts
index 781db46f..48f19be5 100644
--- a/tests/soul-fixes.test.ts
+++ b/tests/soul-fixes.test.ts
@@ -282,6 +282,19 @@ describe("a hand-off over the composer's engine swap", () => {
expect(followEngineDefault(base, base, defaults, "cloud")).toBe(base);
});
+ it("applies ?model= after the composer moved the open default to its stand-in (no caption writer)", () => {
+ // The Image studio's open default is Ideogram 4; where the server writes no caption the composer moves an untouched
+ // one to Qwen-Image 2.1, and a link (a paid model an account has no key for yet, a Models page row) still lands.
+ const image = { cloud: "nano-banana-pro", open: "oss-ideogram-4" };
+ const base = draft("oss-ideogram-4");
+ const standIn = draft("oss-qwen-image-21", { aspectRatio: "1:1" });
+ const next = draft("nano-banana-pro", { aspectRatio: "16:9" });
+ expect(mergeHandoff(followEngineDefault(base, standIn, image, "open"), standIn, next).modelId).toBeUndefined();
+ expect(mergeHandoff(followEngineDefault(base, standIn, image, "open", { open: "oss-qwen-image-21" }), standIn, next)).toMatchObject({ modelId: "nano-banana-pro" });
+ // Qwen-Image 2.1 picked on purpose over a draft that wasn't the default stays.
+ expect(followEngineDefault(draft("flux-2-pro"), standIn, image, "open", { open: "oss-qwen-image-21" }).modelId).toBe("flux-2-pro");
+ });
+
it("keeps the curated eval baseline on the library's pinned commit", () => {
const suite = JSON.parse(fs.readFileSync(path.join(process.cwd(), "scripts/eval/cases/soul-cinema.json"), "utf8")) as { variants: { recipe: { loras: { file: string; url: string }[] } } };
const film = suite.variants.recipe.loras.find((l) => l.file === loraEntry("filmstill")!.file)!;