Hugging Face style model pages at /<org>/<name>
- Model URLs are the repo path (case-insensitive, canonical redirect); /models/<id> redirects - Header with avatar, org/name + copy, task/format/arch/language/license pills, user tags, cross-links to the Hub (files @ sha, commits, community, base model) and tabs: rendered model card at the pinned commit, files, jobs - Sidebar: download card, local copy, model tree with related local models - Metadata gains author avatar and base relation (refetched once) - Proxy matcher excludes only exact /login and /api/auth/ paths Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d16bd6dfee
commit
1527fcd830
29 files changed
+4335
-269
No files matched your search
@@ -82,3 +82,24 @@ function groupBy<T>(items: T[], key: (t: T) => string, value: (t: T) => string |
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Look up a model by "org/name" (case-insensitive, like the Hub). */
|
||||
export async function getModelByRepo(repoId: string) {
|
||||
const row = await db()
|
||||
.select({ id: models.id })
|
||||
.from(models)
|
||||
.where(sql`lower(${models.repoId}) = lower(${repoId})`)
|
||||
.limit(1);
|
||||
return row[0] ? getModel(row[0].id) : null;
|
||||
}
|
||||
|
||||
export type RelatedModel = { repoId: string; quants: string[]; status: string };
|
||||
|
||||
/** Other models in the library that share a base model (e.g. another quant of the same Qwen). */
|
||||
export async function relatedModels(modelId: string, baseModels: string[]): Promise<RelatedModel[]> {
|
||||
if (baseModels.length === 0) return [];
|
||||
const all = await listLibrary();
|
||||
return all
|
||||
.filter((m) => m.id !== modelId && m.baseModels.some((b) => baseModels.includes(b)))
|
||||
.map((m) => ({ repoId: m.repoId, quants: m.quants, status: m.status }));
|
||||
}
|
||||
Reference in new issue
Block a user