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.

⌘K: a real match drops the letter guesses on an open-source-only install too

Adarsh605fa1c3b911
diff --git a/src/lib/command-search.ts b/src/lib/command-search.ts
index 6fee706c..2a25057d 100644
--- a/src/lib/command-search.ts
+++ b/src/lib/command-search.ts
@@ -123,10 +123,11 @@ export const GROUP_LIMIT: Record<PaletteKind, number> = { page: 6, setting: 4, s
/** Matches far weaker than the best one are noise next to it ("lip" finds Lipsync, not "virality predictor"). */
const KEEP_FROM_BEST = 0.35;
/**
- * Once something has the words themselves in it (a substring or better, 40+), letters-in-order guesses (30 at most, plus
- * a page's bonus) are noise: "tts" finds IndexTTS-2, not Settings or Tentacle Horror.
+ * Once something has the words themselves in it (a substring or better: 40, less a hair for a long label), letters-in-order
+ * guesses (30 at most, plus a page's 8) are noise: "tts" finds IndexTTS-2, not Settings or Tentacle Horror.
*/
const KEEP_FROM_REAL_MATCH = 0.6;
+const REAL_MATCH = 39;
/**
* The matches for a query, grouped by kind: each group best first and cut to its limit, the groups
@@ -138,7 +139,7 @@ export function rankPalette(entries: PaletteEntry[], query: string, limits: Reco
if (!normalize(query)) return [];
const scored = entries.map((e) => ({ e, s: entryScore(query, e) })).filter((x) => x.s > 0);
const top = Math.max(0, ...scored.map((x) => x.s));
- const floor = top * (top >= 40 ? KEEP_FROM_REAL_MATCH : KEEP_FROM_BEST);
+ const floor = top * (top >= REAL_MATCH ? KEEP_FROM_REAL_MATCH : KEEP_FROM_BEST);
const byKind = new Map<PaletteKind, { e: PaletteEntry; s: number }[]>();
for (const x of scored) {
if (x.s < floor) continue;
diff --git a/tests/command-palette.test.ts b/tests/command-palette.test.ts
index d05be489..865ce99d 100644
--- a/tests/command-palette.test.ts
+++ b/tests/command-palette.test.ts
@@ -98,6 +98,15 @@ describe("palette ranking", () => {
expect(rankPalette([...ALL, ...entries], "turntable").find((g) => g.kind === "skill")?.entries.map((e) => e.label)).toEqual(["Run Lamp turntable…"]);
});
+ it("drops letters-in-order guesses next to a real match", () => {
+ // An open-source-only install (every visitor's): IndexTTS-2 is the one model with "tts" in its name.
+ const tts = top("tts", [...PAGES, ...indexEntries(index, "open")]);
+ expect(tts).toContain("IndexTTS-2");
+ for (const noise of ["Settings", "Tentacle Horror", "Glitter Sticker", "Bullet Time Scene"]) expect(tts, noise).not.toContain(noise);
+ // With no real match, the guesses stay: a typo still finds its page.
+ expect(top("cinma")).toContain("Cinema Studio");
+ });
+
it("matches nothing on an empty query (the palette shows its own start list)", () => {
expect(rankPalette(ALL, "")).toEqual([]);
expect(rankPalette(ALL, " ")).toEqual([]);