Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 1x 1x 1207x 151x 345x 150x 150x 1x 42x 42x 42x 42x 84x 84x 420x 420x 76x 76x 76x 420x 84x 42x 42x 1x 1490x 1490x 30x 30x 1478x 2467x 2467x 1478x 4x 4x 486x 486x | // Helpers for the canonical model ref shape lilbee speaks. Refs come in three
// flavours: native HF refs ("<org>/<repo>/<filename>.gguf"), provider refs
// ("ollama/qwen3:8b", "openai/gpt-4o", …), and opaque strings. The helpers
// below convert them for display or unwrap them for catalog comparison.
const PROVIDER_PREFIXES = ["ollama/", "openai/", "anthropic/", "gemini/", "cohere/"];
const STRIP_SUFFIXES = [/-GGUF$/i, /-Instruct$/i, /-Chat$/i, /-v\d+(\.\d+)*$/i, /-\d{4}$/];
const META_PREFIX = /^Meta-/;
/** Strip the trailing `/<filename>.gguf` from a full HF ref so it matches a `CatalogEntry.hf_repo`. */
export function extractHfRepo(ref: string): string {
if (!ref.endsWith(".gguf")) return ref;
const slash = ref.lastIndexOf("/");
if (slash <= 0) return ref;
return ref.slice(0, slash);
}
/** Convert a `<repo>` segment (org-stripped) into a friendly label. Mirrors the server's `clean_display_name`. */
export function cleanDisplayName(repo: string): string {
let name = repo.includes("/") ? repo.slice(repo.indexOf("/") + 1) : repo;
name = name.replace(META_PREFIX, "");
let changed = true;
while (changed) {
changed = false;
for (const suffix of STRIP_SUFFIXES) {
const next = name.replace(suffix, "");
if (next !== name) {
name = next;
changed = true;
}
}
}
return name.replace(/-/g, " ").replace(/\s+/g, " ").trim();
}
/** Turn any model ref into a label suitable for the status bar, dropdowns, and notices. */
export function displayLabelForRef(ref: string): string {
if (!ref) return "";
if (ref.endsWith(".gguf") && ref.includes("/")) {
return cleanDisplayName(extractHfRepo(ref));
}
for (const prefix of PROVIDER_PREFIXES) {
if (ref.startsWith(prefix)) return ref.slice(prefix.length);
}
if (ref.includes("/")) {
return cleanDisplayName(ref);
}
return ref;
}
|