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
@@ -1,9 +1,11 @@
|
||||
import { FileRoleBadge } from "@/components/labels";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { groupJobFiles } from "@/lib/file-groups";
|
||||
import { formatBytes, percent } from "@/lib/format";
|
||||
import type { JobFileSnapshot } from "@/lib/jobs";
|
||||
|
||||
/** Per-file progress of one job. */
|
||||
/** Per-file progress of one job (split files as one entry). */
|
||||
export function JobFilesTable({ files }: { files: JobFileSnapshot[] }) {
|
||||
return (
|
||||
<Table>
|
||||
@@ -15,16 +17,26 @@ export function JobFilesTable({ files }: { files: JobFileSnapshot[] }) {
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{files.map((f) => {
|
||||
{groupJobFiles(files).map((f) => {
|
||||
const pct = percent(f.doneBytes, f.expectedBytes);
|
||||
return (
|
||||
<TableRow key={f.modelFileId}>
|
||||
<TableCell className="font-mono text-xs break-all whitespace-normal">{f.path}</TableCell>
|
||||
<TableRow key={f.path}>
|
||||
<TableCell className="whitespace-normal">
|
||||
<span className="flex items-center gap-2">
|
||||
<FileRoleBadge path={f.path} />
|
||||
<span className="font-mono text-xs break-all">{f.path}</span>
|
||||
{f.parts > 1 && (
|
||||
<span className="shrink-0 rounded border px-1 text-[10px] leading-4 text-muted-foreground">
|
||||
{f.parts} parts
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
<Progress value={pct} className="flex-1" />
|
||||
<span className="w-12 text-right text-xs text-muted-foreground tabular-nums">
|
||||
{f.state === "failed" ? "missing" : `${pct.toFixed(0)}%`}
|
||||
{f.failed ? "missing" : `${pct.toFixed(0)}%`}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
import { BADGE_CLASS } from "@/lib/colors";
|
||||
import { FILE_ROLES, fileRole, type FileRoleStyles } from "@/lib/file-roles";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const defaults = Object.fromEntries(
|
||||
Object.entries(FILE_ROLES).map(([role, r]) => [role, { label: r.label, color: r.color }]),
|
||||
) as FileRoleStyles;
|
||||
|
||||
const LabelContext = createContext<FileRoleStyles>(defaults);
|
||||
|
||||
/** Provides the label settings (from the Settings page) to client components. */
|
||||
export function LabelSettingsProvider({ fileRoles, children }: { fileRoles: FileRoleStyles; children: React.ReactNode }) {
|
||||
return <LabelContext.Provider value={fileRoles}>{children}</LabelContext.Provider>;
|
||||
}
|
||||
|
||||
export function useFileRoleStyles(): FileRoleStyles {
|
||||
return useContext(LabelContext);
|
||||
}
|
||||
|
||||
/** Label in front of a file name telling what the file is (Model, MTP, Vision, …). */
|
||||
export function FileRoleBadge({ path, className }: { path: string; className?: string }) {
|
||||
const styles = useFileRoleStyles();
|
||||
const role = fileRole(path);
|
||||
const style = styles[role];
|
||||
return (
|
||||
<span
|
||||
title={FILE_ROLES[role].description}
|
||||
className={cn(
|
||||
"inline-flex h-5 min-w-16 shrink-0 items-center justify-center rounded-md border px-1.5 text-[11px] font-medium whitespace-nowrap",
|
||||
BADGE_CLASS[style.color],
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{style.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,55 +1,25 @@
|
||||
import { autoTagColor, BADGE_CLASS, DOT_CLASS, isLabelColor, type LabelColor } from "@/lib/colors";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// Fixed palette (full class strings so Tailwind picks them up). A tag's color is derived from its
|
||||
// name, so the same tag has the same color everywhere without storing anything.
|
||||
const PALETTE = [
|
||||
"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",
|
||||
"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
||||
"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
||||
"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300",
|
||||
"border-violet-500/30 bg-violet-500/10 text-violet-700 dark:text-violet-300",
|
||||
"border-cyan-500/30 bg-cyan-500/10 text-cyan-700 dark:text-cyan-300",
|
||||
"border-lime-500/30 bg-lime-500/10 text-lime-700 dark:text-lime-300",
|
||||
"border-orange-500/30 bg-orange-500/10 text-orange-700 dark:text-orange-300",
|
||||
"border-fuchsia-500/30 bg-fuchsia-500/10 text-fuchsia-700 dark:text-fuchsia-300",
|
||||
"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",
|
||||
];
|
||||
|
||||
const DOTS = [
|
||||
"bg-sky-500",
|
||||
"bg-emerald-500",
|
||||
"bg-amber-500",
|
||||
"bg-rose-500",
|
||||
"bg-violet-500",
|
||||
"bg-cyan-500",
|
||||
"bg-lime-500",
|
||||
"bg-orange-500",
|
||||
"bg-fuchsia-500",
|
||||
"bg-teal-500",
|
||||
];
|
||||
|
||||
function colorIndex(name: string): number {
|
||||
let h = 0;
|
||||
for (const ch of name.trim().toLowerCase()) h = (h * 31 + ch.codePointAt(0)!) >>> 0;
|
||||
return h % PALETTE.length;
|
||||
}
|
||||
|
||||
export function tagColorClass(name: string): string {
|
||||
return PALETTE[colorIndex(name)];
|
||||
/** The tag's chosen color, or a stable automatic one derived from its name. */
|
||||
export function tagColor(name: string, color?: string | null): LabelColor {
|
||||
return isLabelColor(color) ? color : autoTagColor(name);
|
||||
}
|
||||
|
||||
/** Small colored dot for a tag (e.g. in filter menus). */
|
||||
export function TagDot({ name }: { name: string }) {
|
||||
return <span className={cn("inline-block size-2 shrink-0 rounded-full", DOTS[colorIndex(name)])} />;
|
||||
export function TagDot({ name, color }: { name: string; color?: string | null }) {
|
||||
return <span className={cn("inline-block size-2 shrink-0 rounded-full", DOT_CLASS[tagColor(name, color)])} />;
|
||||
}
|
||||
|
||||
/** A user tag, colored by its name. */
|
||||
/** A user tag, in its color. */
|
||||
export function TagBadge({
|
||||
name,
|
||||
color,
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
name: string;
|
||||
color?: string | null;
|
||||
className?: string;
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
@@ -57,7 +27,7 @@ export function TagBadge({
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex h-5 items-center gap-1 rounded-full border px-2 text-xs font-medium whitespace-nowrap",
|
||||
tagColorClass(name),
|
||||
BADGE_CLASS[tagColor(name, color)],
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user