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.

Models: the picker shows each model once

Adarsh78014acba779
diff --git a/src/lib/composer.ts b/src/lib/composer.ts
index 0f636b5b..19bc6d7e 100644
--- a/src/lib/composer.ts
+++ b/src/lib/composer.ts
@@ -981,8 +981,10 @@ export function matchScore(m: Pick<ModelDef, "name" | "vendor" | "tagline" | "fa
/**
* The picker's sections. Without a query: Recent (last 3 used), Starred, Best for this studio
- * and All, for the selected engine; a model sits in the first section it belongs to (All lists
- * everything). With a query: one list across every allowed engine, best matches first.
+ * and All models, for the selected engine. Every model shows once: it sits in the first section
+ * it belongs to, so All models lists only the ones the sections above it leave out. `count` is
+ * still every model of the engine. With a query: one list across every allowed engine, best
+ * matches first.
*/
export function groupModels(input: {
models: ModelDef[];
@@ -1022,7 +1024,7 @@ export function groupModels(input: {
{ id: "recent", label: "Recent", models: take(recent, 3) },
{ id: "starred", label: "Starred", models: take(starred, 50) },
{ id: "best", label: "Best for this studio", models: take(best, 4) },
- { id: "all", label: "All models", models: pool },
+ { id: "all", label: "All models", models: pool.filter((m) => !used.has(m.id)) },
];
return { groups: groups.filter((g) => g.models.length), count: pool.length };
}
diff --git a/tests/composer.test.ts b/tests/composer.test.ts
index 85d152fe..8c335211 100644
--- a/tests/composer.test.ts
+++ b/tests/composer.test.ts
@@ -235,7 +235,7 @@ describe("model picker groups", () => {
expect(models.map((m) => m.id)).toEqual(modelsFor({ kind: IMAGE_STUDIO.kind, ops: IMAGE_STUDIO.ops }).map((m) => m.id));
});
- it("puts Recent, Starred and Best above All, each model once among them", () => {
+ it("puts Recent, Starred and Best above All models, and shows every model once", () => {
const best = bestForStudio(models, "cloud", IMAGE_STUDIO.defaultModels.cloud).map((m) => m.id);
expect(best[0]).toBe("nano-banana-pro");
expect(best.length).toBeLessThanOrEqual(4);
@@ -249,10 +249,20 @@ describe("model picker groups", () => {
expect(groups[1].models.map((m) => m.id)).toEqual([cloud[6].id]);
const top = new Set([...groups[0].models, ...groups[1].models, ...groups[2].models].map((m) => m.id));
expect(top.size).toBe(groups[0].models.length + groups[1].models.length + groups[2].models.length);
- expect(groups[3].models).toHaveLength(cloud.length);
+ // All models leaves out what the sections above already show; the count is still every model.
+ expect(groups[3].models.some((m) => top.has(m.id))).toBe(false);
+ expect(groups[3].models).toHaveLength(cloud.length - top.size);
+ expect(groups.flatMap((g) => g.models.map((m) => m.id)).sort()).toEqual(cloud.map((m) => m.id).sort());
expect(count).toBe(cloud.length);
});
+ it("drops All models when the sections above already show every model", () => {
+ const few = cloud.slice(0, 3);
+ const { groups, count } = groupModels({ models: few, engine: "cloud", engines: ["cloud"], query: "", recent: [few[0].id], starred: [few[1].id], best: [few[2].id] });
+ expect(groups.map((g) => g.id)).toEqual(["recent", "starred", "best"]);
+ expect(count).toBe(3);
+ });
+
it("searches both engines (best match first) and respects a locked engine", () => {
const both = groupModels({ models, engine: "cloud", engines: ["cloud", "open"], query: "qwen", recent: [], starred: [], best: [] });
expect(both.groups).toHaveLength(1);