- Rename the app to Kaname - Hub metadata per model (base models, architecture, license, Hub tags), backfilled by the worker for existing models - Library search across repo/author/family/quant/tags and multi-select facet filters (author, family, quant, tag, status) kept in the URL - Custom tags (model page editor, on add, click-to-filter) - README rewritten around a quick install, with banner and screenshots - deploy/compose.yaml: models in a host folder (KANAME_MODELS_DIR) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2167ea0950
commit
67191b3e16
37 files changed
+2028
-206
No files matched your search
@@ -0,0 +1,59 @@
|
||||
// Pure helpers that turn Hub model info into searchable metadata. Shared by web and worker.
|
||||
|
||||
export type RepoMetadata = {
|
||||
author: string | null;
|
||||
baseModels: string[];
|
||||
architecture: string | null;
|
||||
pipelineTag: string | null;
|
||||
license: string | null;
|
||||
hubTags: string[];
|
||||
};
|
||||
|
||||
type HubModelInfo = {
|
||||
id?: string;
|
||||
author?: string;
|
||||
pipeline_tag?: string;
|
||||
tags?: string[];
|
||||
cardData?: { base_model?: string | string[]; license?: string | string[] } | null;
|
||||
gguf?: { architecture?: string } | null;
|
||||
config?: { model_type?: string } | null;
|
||||
};
|
||||
|
||||
/** Hub tags that carry no useful search signal (or are stored separately). */
|
||||
const NOISE_TAG = /^(arxiv|region|deploy|base_model|license|doi|dataset):|^(endpoints_compatible|autotrain_compatible|eval-results|text-generation-inference|conversational)$/;
|
||||
|
||||
const asArray = (v: string | string[] | undefined | null): string[] =>
|
||||
v == null ? [] : (Array.isArray(v) ? v : [v]).filter((x): x is string => typeof x === "string" && x.length > 0);
|
||||
|
||||
export function parseRepoMetadata(info: HubModelInfo): RepoMetadata {
|
||||
const tags = info.tags ?? [];
|
||||
|
||||
// Prefer the model card; fall back to "base_model:<relation>:<id>" / "base_model:<id>" tags.
|
||||
let baseModels = asArray(info.cardData?.base_model);
|
||||
if (baseModels.length === 0) {
|
||||
baseModels = tags
|
||||
.filter((t) => t.startsWith("base_model:"))
|
||||
.map((t) => t.split(":").at(-1)!)
|
||||
.filter((id) => id.includes("/"));
|
||||
}
|
||||
|
||||
const license = asArray(info.cardData?.license)[0] ?? tags.find((t) => t.startsWith("license:"))?.slice(8) ?? null;
|
||||
|
||||
return {
|
||||
author: info.author ?? info.id?.split("/")[0] ?? null,
|
||||
baseModels: [...new Set(baseModels)],
|
||||
architecture: info.gguf?.architecture ?? info.config?.model_type ?? null,
|
||||
pipelineTag: info.pipeline_tag ?? null,
|
||||
license,
|
||||
hubTags: [...new Set(tags.filter((t) => !NOISE_TAG.test(t)))],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The model "family" for filtering: the org of the base model(s) (unsloth/Qwen3-8B-GGUF → "Qwen"),
|
||||
* or the repo's own org for original models without a base model.
|
||||
*/
|
||||
export function modelFamilies(repoId: string, baseModels: string[] | null | undefined): string[] {
|
||||
const orgs = (baseModels ?? []).map((b) => b.split("/")[0]).filter(Boolean);
|
||||
return orgs.length > 0 ? [...new Set(orgs)] : [repoId.split("/")[0]];
|
||||
}
|
||||
Reference in new issue
Block a user