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
@@ -1,13 +1,15 @@
|
||||
import { eq, isNull } from "drizzle-orm";
|
||||
import { db } from "@/lib/db/client";
|
||||
import { models } from "@/lib/db/schema";
|
||||
import { getRepoInfo } from "./client";
|
||||
import { getAuthorAvatar, getRepoInfo } from "./client";
|
||||
import type { RepoMetadata } from "./metadata";
|
||||
|
||||
/** Columns to write on `models` for fetched Hub metadata. */
|
||||
export function metadataColumns(meta: RepoMetadata) {
|
||||
export function metadataColumns(meta: RepoMetadata, authorAvatarUrl: string | null) {
|
||||
return {
|
||||
baseModels: meta.baseModels,
|
||||
baseRelation: meta.baseRelation,
|
||||
authorAvatarUrl,
|
||||
architecture: meta.architecture,
|
||||
pipelineTag: meta.pipelineTag,
|
||||
license: meta.license,
|
||||
@@ -29,7 +31,8 @@ export async function backfillMetadata(onError: (repoId: string, err: unknown) =
|
||||
for (const m of missing) {
|
||||
try {
|
||||
const info = await getRepoInfo(m.repoId, m.pinnedSha);
|
||||
await db().update(models).set(metadataColumns(info.metadata)).where(eq(models.id, m.id));
|
||||
const avatar = await getAuthorAvatar(m.repoId.split("/")[0]);
|
||||
await db().update(models).set(metadataColumns(info.metadata, avatar)).where(eq(models.id, m.id));
|
||||
updated++;
|
||||
} catch (err) {
|
||||
onError(m.repoId, err);
|
||||
|
||||
Reference in new issue
Block a user