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.

Auto: an account's plain prompt starts on Krea 2 Realism

Adarsha7affc9e087f
diff --git a/src/lib/auto-image.ts b/src/lib/auto-image.ts
index ad719634..9be809e6 100644
--- a/src/lib/auto-image.ts
+++ b/src/lib/auto-image.ts
@@ -123,12 +123,17 @@ export interface AutoAsk {
op?: Operation;
/** Pictures the run works from (its references). */
images?: number;
+ /**
+ * A signed-up account's run (not the owner's): a plain prompt starts on Krea 2 Realism, because Ideogram 4 can take
+ * minutes to decline and the account would wait for the fallback. Lettering still goes to Ideogram 4.
+ */
+ account?: boolean;
}
/**
* The models Auto would plan a run on, best first, and why: a picture to work from → the studio's edit model for its
* operation; lettering → Ideogram 4; a prompt the setting's patterns match → Krea 2 Realism (then FIBO 2 Dev and
- * MOSS-Image, then Ideogram 4); anything else → Ideogram 4 (then the others). The server plans the first one that is
+ * MOSS-Image, then Ideogram 4); an account's plain prompt → Krea 2 Realism first too; anything else → Ideogram 4 (then the others). The server plans the first one that is
* switched on and runs the operation (src/server/generations.ts autoRouted).
*/
export function autoCandidates(ask: AutoAsk, patterns: readonly { line: string; re: RegExp }[]): { models: string[]; why: AutoWhy; pattern?: string } {
@@ -138,6 +143,7 @@ export function autoCandidates(ask: AutoAsk, patterns: readonly { line: string;
if (asksForText(words)) return { models: [AUTO_TEXT_MODEL, ...AUTO_FALLBACKS], why: "text" };
const pattern = matchedPattern(words, patterns);
if (pattern) return { models: [...AUTO_FALLBACKS, AUTO_TEXT_MODEL], why: "trigger", pattern };
+ if (ask.account) return { models: [...AUTO_FALLBACKS, AUTO_TEXT_MODEL], why: "plain" };
return { models: [AUTO_TEXT_MODEL, ...AUTO_FALLBACKS], why: "plain" };
}
diff --git a/src/server/generations.ts b/src/server/generations.ts
index ede7f4c6..744c23b8 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -1345,7 +1345,7 @@ function autoRouted(req: GenerationRequest): GenerationRequest {
const op = req.op && m?.routes.some((r) => r.op === req.op) ? req.op : undefined;
return { ...req, modelId: req.auto.model, op: op ?? (images ? "edit" : "t2i") };
}
- const c = autoCandidates({ prompt: req.prompt, op: req.op, images }, autoPatternsNow());
+ const c = autoCandidates({ prompt: req.prompt, op: req.op, images, account: !!req.account }, autoPatternsNow());
const op: Operation = c.why === "edit" ? (req.op && req.op !== "t2i" ? req.op : "edit") : "t2i";
const runs = (id: string) => {
const m = getModel(id);
diff --git a/tests/auto-image-pool.test.ts b/tests/auto-image-pool.test.ts
index 015dbbdf..29908bca 100644
--- a/tests/auto-image-pool.test.ts
+++ b/tests/auto-image-pool.test.ts
@@ -170,7 +170,7 @@ describe("an account's free run of Auto on this install's GPUs", () => {
const a = account();
accountId = a.id;
ideogram = [[card]];
- const r = await post({ feature: "image", modelId: AUTO_IMAGE, prompt: "a red fox in deep snow", params: { aspectRatio: "4:5" } }, a.cookie);
+ const r = await post({ feature: "image", modelId: AUTO_IMAGE, prompt: "a poster of a red fox in deep snow that says \"WINTER\"", params: { aspectRatio: "4:5" } }, a.cookie);
expect(r.status, JSON.stringify(r.body)).toBe(201);
const id = r.body.items![0].id;
const g = await settled(id);
@@ -196,7 +196,7 @@ describe("an account's free run of Auto on this install's GPUs", () => {
expect(JSON.stringify(getGeneration(id))).not.toContain("spread");
const listed = listAccountRuns({ account: a.id }).items.find((x) => x.id === id)!;
expect(listed.declinedCards).toHaveLength(1);
- expect(listed.request.prompt).toBe("a red fox in deep snow");
+ expect(listed.request.prompt).toBe("a poster of a red fox in deep snow that says \"WINTER\"");
});
it("each next model only when the one before fails, still one run", async () => {
@@ -204,7 +204,7 @@ describe("an account's free run of Auto on this install's GPUs", () => {
accountId = a.id;
ideogram = [[card]];
failing = new Set(["oss-krea2-realism", "oss-fibo2-dev"]);
- const r = await post({ feature: "image", modelId: AUTO_IMAGE, prompt: "a lighthouse at dusk" }, a.cookie);
+ const r = await post({ feature: "image", modelId: AUTO_IMAGE, prompt: "a sign that says \"LIGHTHOUSE\" at dusk" }, a.cookie);
expect(r.status, JSON.stringify(r.body)).toBe(201);
const g = await settled(r.body.items![0].id);
expect(g.status, g.error ?? "").toBe("succeeded");
@@ -223,7 +223,7 @@ describe("an account's free run of Auto on this install's GPUs", () => {
expect(price.status, JSON.stringify(price.body)).toBe(200);
expect(price.body).toMatchObject({ place: "pool", modelId: "oss-krea2-realism", modelName: "Krea 2 Realism", quote: { allowed: true } });
const plain = await post({ ...cat, prompt: "a koi pond at night" }, a.cookie, true);
- expect(plain.body).toMatchObject({ place: "pool", modelId: "oss-ideogram-4", quote: { allowed: true } });
+ expect(plain.body).toMatchObject({ place: "pool", modelId: "oss-krea2-realism", quote: { allowed: true } });
const r = await post(cat, a.cookie);
expect(r.status, JSON.stringify(r.body)).toBe(201);
const g = await settled(r.body.items![0].id);
diff --git a/tests/auto-image.test.ts b/tests/auto-image.test.ts
index 8f6e9695..6453d4d6 100644
--- a/tests/auto-image.test.ts
+++ b/tests/auto-image.test.ts
@@ -105,6 +105,14 @@ describe("what Auto picks", () => {
expect(pick(words), words).toMatchObject({ models: ["oss-ideogram-4", ...AUTO_FALLBACKS], why: "plain" });
});
+ it("an account's plain prompt starts on Krea 2 Realism; its lettering and edits route as the owner's", () => {
+ const acct = (prompt: string, more: { op?: "t2i" | "edit"; images?: number } = {}) => autoCandidates({ prompt, ...more, account: true }, defaults);
+ for (const words of ["a koi pond at night, neon rain", "a woman in a red evening gown on a staircase"])
+ expect(acct(words), words).toMatchObject({ models: [...AUTO_FALLBACKS, "oss-ideogram-4"], why: "plain" });
+ expect(acct('a poster that says "OPEN LATE"')).toMatchObject({ models: ["oss-ideogram-4", ...AUTO_FALLBACKS], why: "text" });
+ expect(acct("make the dress red", { images: 1 }).why).toBe("edit");
+ });
+
it("after Ideogram 4 declines: Krea 2 Realism, FIBO 2 Dev, MOSS-Image, then none", () => {
expect(AUTO_FALLBACKS).toEqual(["oss-krea2-realism", "oss-fibo2-dev", "oss-moss-image"]);
expect(nextAutoFallback(undefined)).toBe("oss-krea2-realism");