Milestone (b): repo lookup and file selection
- Hub API client: resolve revision to SHA, paginated recursive file tree, gated-access probe, readable error mapping - Add-model page with quant quick-select, fnmatch-compatible include/exclude globs, selection summary and free-space hint - Models stored pinned to the reviewed SHA with full file list and selection rule - Library list, model detail page, remove (never-downloaded models only) - Worker reports MODELS_DIR free space; unit tests for selection logic Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
891e496157
commit
8f7ac60ccf
35 files changed
+2567
-19
No files matched your search
+67
-8
@@ -1,15 +1,74 @@
|
||||
import Link from "next/link";
|
||||
import { ModelStatusBadge } from "@/components/model-status-badge";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { formatBytes, formatDate, shortSha } from "@/lib/format";
|
||||
import { listLibrary } from "@/lib/library";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function LibraryPage() {
|
||||
const rows = await listLibrary();
|
||||
|
||||
export default function LibraryPage() {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h1 className="text-xl font-semibold">Library</h1>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>No models yet</CardTitle>
|
||||
<CardDescription>Adding models from Hugging Face comes in the next milestone.</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold">Library</h1>
|
||||
<Link href="/models/new" className={buttonVariants()}>
|
||||
Add model
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>No models yet</CardTitle>
|
||||
<CardDescription>Add a Hugging Face repo to get started.</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
) : (
|
||||
<Card className="py-0">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Repository</TableHead>
|
||||
<TableHead>Selection</TableHead>
|
||||
<TableHead className="text-right">Size</TableHead>
|
||||
<TableHead>Pinned</TableHead>
|
||||
<TableHead className="hidden md:table-cell">Downloaded</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{rows.map((r) => (
|
||||
<TableRow key={r.id}>
|
||||
<TableCell className="font-medium">
|
||||
<Link href={`/models/${r.id}`} className="hover:underline">
|
||||
{r.repoId}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm">
|
||||
{r.quants.length > 0 ? r.quants.join(", ") : `${r.fileCount} files`}
|
||||
</TableCell>
|
||||
<TableCell className="text-right tabular-nums">{formatBytes(r.totalBytes)}</TableCell>
|
||||
<TableCell>
|
||||
<code className="font-mono text-xs" title={r.pinnedSha}>
|
||||
{r.trackedRevision}@{shortSha(r.pinnedSha)}
|
||||
</code>
|
||||
</TableCell>
|
||||
<TableCell className="hidden text-sm text-muted-foreground md:table-cell">
|
||||
{formatDate(r.downloadedAt)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ModelStatusBadge status={r.status} />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user