Download more, file labels, split-file grouping, settings for labels and tags
- Files tab: "Download more" adds files to a model's selection and queues them - Colored file labels (Model, MTP, Vision/mmproj, imatrix, Config, …) - Split GGUF/safetensors parts shown and selected as one entry everywhere - Settings page with a Labels section: file label names/colors, tag rename/recolor/delete; new settings table and tags.color - Quants only count model weights Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5211ec9064
commit
df18415e02
34 files changed
+2256
-132
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { FileRoleBadge } from "@/components/labels";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
@@ -10,6 +11,7 @@ import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { groupSplitFiles } from "@/lib/file-groups";
|
||||
import { formatBytes, shortSha } from "@/lib/format";
|
||||
import type { LookupResult } from "@/lib/hub/lookup";
|
||||
import { escapeGlob, matchesAny, parsePatternList, quantGroup } from "@/lib/selection";
|
||||
@@ -105,14 +107,19 @@ export function AddModelForm({
|
||||
}, [files]);
|
||||
|
||||
const selected = files.filter((f) => f.selected);
|
||||
// Split files are one row; its checkbox covers all parts.
|
||||
const entries = useMemo(() => groupSplitFiles(files), [files]);
|
||||
const selectedEntries = entries.filter((e) => e.parts.every((f) => f.selected)).length;
|
||||
const totalBytes = selected.reduce((s, f) => s + f.size, 0);
|
||||
const notEnoughSpace = freeBytes != null && totalBytes > freeBytes;
|
||||
|
||||
function toggle(path: string, on: boolean) {
|
||||
function toggle(paths: string[], on: boolean) {
|
||||
setChecked((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (on) next.add(path);
|
||||
else next.delete(path);
|
||||
for (const path of paths) {
|
||||
if (on) next.add(path);
|
||||
else next.delete(path);
|
||||
}
|
||||
return next;
|
||||
});
|
||||
}
|
||||
@@ -311,33 +318,43 @@ export function AddModelForm({
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{files.map((f) => (
|
||||
<TableRow key={f.path} data-state={f.selected ? "selected" : undefined}>
|
||||
<TableCell>
|
||||
<Checkbox
|
||||
checked={f.selected}
|
||||
disabled={f.byPattern || f.excluded}
|
||||
onCheckedChange={(v) => toggle(f.path, v === true)}
|
||||
aria-label={`Select ${f.path}`}
|
||||
title={
|
||||
f.excluded
|
||||
? "Excluded by a pattern"
|
||||
: f.byPattern
|
||||
? "Selected by an include pattern"
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="font-mono text-xs break-all whitespace-normal">
|
||||
{f.path}
|
||||
{f.excluded && <span className="ml-2 text-muted-foreground">(excluded)</span>}
|
||||
</TableCell>
|
||||
<TableCell className="text-right tabular-nums">{formatBytes(f.size)}</TableCell>
|
||||
<TableCell className="hidden text-xs text-muted-foreground sm:table-cell">
|
||||
{f.lfsSha256 ? "LFS" : "git"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
{entries.map((e) => {
|
||||
const parts = e.parts;
|
||||
const all = parts.every((f) => f.selected);
|
||||
const some = !all && parts.some((f) => f.selected);
|
||||
const byPattern = parts.every((f) => f.byPattern);
|
||||
const excluded = parts.every((f) => f.excluded);
|
||||
return (
|
||||
<TableRow key={e.path} data-state={all ? "selected" : undefined}>
|
||||
<TableCell>
|
||||
<Checkbox
|
||||
checked={all}
|
||||
indeterminate={some}
|
||||
disabled={byPattern || excluded}
|
||||
onCheckedChange={(v) => toggle(parts.map((f) => f.path), v === true)}
|
||||
aria-label={`Select ${e.path}`}
|
||||
title={excluded ? "Excluded by a pattern" : byPattern ? "Selected by an include pattern" : undefined}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-normal">
|
||||
<span className="flex items-center gap-2" title={e.totalParts > 1 ? parts.map((f) => f.path).join("\n") : undefined}>
|
||||
<FileRoleBadge path={e.path} />
|
||||
<span className="font-mono text-xs break-all">{e.path}</span>
|
||||
{e.totalParts > 1 && (
|
||||
<span className="shrink-0 rounded border px-1 text-[10px] leading-4 text-muted-foreground">
|
||||
{e.totalParts} parts
|
||||
</span>
|
||||
)}
|
||||
{excluded && <span className="text-xs text-muted-foreground">(excluded)</span>}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className="text-right tabular-nums">{formatBytes(e.size)}</TableCell>
|
||||
<TableCell className="hidden text-xs text-muted-foreground sm:table-cell">
|
||||
{parts[0].lfsSha256 ? "LFS" : "git"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
@@ -346,7 +363,7 @@ export function AddModelForm({
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2">
|
||||
<div className="text-sm">
|
||||
<span className="font-medium">
|
||||
{selected.length} file{selected.length === 1 ? "" : "s"} · {formatBytes(totalBytes)}
|
||||
{selectedEntries} file{selectedEntries === 1 ? "" : "s"} · {formatBytes(totalBytes)}
|
||||
</span>{" "}
|
||||
selected
|
||||
{freeBytes != null && (
|
||||
|
||||
Reference in new issue
Block a user