MCPcopy Create free account
hub / github.com/block/buzz / classifyModelRef

Function classifyModelRef

desktop/src/features/mesh-compute/classifyModelRef.ts:25–45  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

23 * makes the free-text field feel honest instead of opaque.
24 */
25export function classifyModelRef(raw: string): ModelRefKind {
26 const trimmed = raw.trim();
27 if (trimmed.length === 0) {
28 return { kind: "unknown" };
29 }
30 if (trimmed.startsWith("hf://")) {
31 return { kind: "huggingface", ref: trimmed };
32 }
33 // Local path heuristics. Conservative: only mark as path when there are
34 // unambiguous signals (leading separator, home shortcut, .gguf extension).
35 const looksLikePath =
36 trimmed.startsWith("/") ||
37 trimmed.startsWith("./") ||
38 trimmed.startsWith("../") ||
39 trimmed.startsWith("~") ||
40 trimmed.toLowerCase().endsWith(".gguf");
41 if (looksLikePath) {
42 return { kind: "local-path", path: trimmed };
43 }
44 return { kind: "catalog", name: trimmed };
45}
46
47/** Short label for the inline hint, e.g. "Looks like a catalog name". */
48export function modelRefHintLabel(kind: ModelRefKind): string | null {

Callers 2

MeshComputeSettingsCardFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected