Picking model weights in Add model or Download more also selects the files that usually go with them (chat template, MTP head, mmproj, ...), shown in a strip where each can be unchecked. Variants are matched by quant, otherwise the best single one; kinds already selected aren't added twice. Which kinds is set in Settings -> Downloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
"use client";
|
|
|
|
import { SparklesIcon } from "lucide-react";
|
|
import Link from "next/link";
|
|
import { FileRoleBadge } from "@/components/labels";
|
|
import { Checkbox } from "@/components/ui/checkbox";
|
|
import { groupSplitFiles } from "@/lib/file-groups";
|
|
import { formatBytes } from "@/lib/format";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
/** Companion files picked along with the chosen quant; each can be unchecked. */
|
|
export function RecommendedStrip({
|
|
files,
|
|
paths,
|
|
active,
|
|
onToggle,
|
|
className,
|
|
}: {
|
|
files: { path: string; size: number }[];
|
|
/** All recommended paths (checked or not). */
|
|
paths: string[];
|
|
active: Set<string>;
|
|
onToggle: (paths: string[], on: boolean) => void;
|
|
className?: string;
|
|
}) {
|
|
if (paths.length === 0) return null;
|
|
const wanted = new Set(paths);
|
|
const entries = groupSplitFiles(files.filter((f) => wanted.has(f.path)));
|
|
|
|
return (
|
|
<div className={cn("flex flex-col gap-2 rounded-lg bg-muted/50 px-3 py-2.5 ring-1 ring-foreground/5", className)}>
|
|
<div className="flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground">
|
|
<span className="flex items-center gap-1.5 font-medium text-foreground">
|
|
<SparklesIcon className="size-3.5 text-amber-500" />
|
|
Recommended with your quant
|
|
</span>
|
|
<Link href="/settings/downloads" className="hover:text-foreground hover:underline">
|
|
Change in Settings
|
|
</Link>
|
|
</div>
|
|
<div className="flex flex-wrap gap-2">
|
|
{entries.map((e) => {
|
|
const parts = e.parts.map((p) => p.path);
|
|
const on = parts.every((p) => active.has(p));
|
|
return (
|
|
<label
|
|
key={e.path}
|
|
className={cn(
|
|
"flex cursor-pointer items-center gap-2 rounded-md border bg-background px-2 py-1 text-xs transition-opacity",
|
|
!on && "opacity-60",
|
|
)}
|
|
>
|
|
<Checkbox checked={on} onCheckedChange={(v) => onToggle(parts, v === true)} aria-label={`Download ${e.path}`} />
|
|
<FileRoleBadge path={e.path} />
|
|
<span className="font-mono break-all">{e.path}</span>
|
|
<span className="text-muted-foreground tabular-nums">{formatBytes(e.size)}</span>
|
|
</label>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|