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
@@ -0,0 +1,61 @@
|
||||
// Group split files ("model-00001-of-00003.gguf", …) into one entry for display and selection.
|
||||
|
||||
const SPLIT = /^(.*)-(\d{5})-of-(\d{5})(\.[^./]+)$/;
|
||||
|
||||
export type SplitInfo = { base: string; part: number; total: number };
|
||||
|
||||
/** "BF16/X-BF16-00001-of-00002.gguf" → { base: "BF16/X-BF16.gguf", part: 1, total: 2 }. */
|
||||
export function splitInfo(path: string): SplitInfo | null {
|
||||
const m = path.match(SPLIT);
|
||||
if (!m) return null;
|
||||
return { base: `${m[1]}${m[4]}`, part: Number(m[2]), total: Number(m[3]) };
|
||||
}
|
||||
|
||||
export type FileGroup<T> = {
|
||||
/** Display path: the file itself, or the shared name of a split file without the part suffix. */
|
||||
path: string;
|
||||
/** Files in this entry, in part order. */
|
||||
parts: T[];
|
||||
size: number;
|
||||
/** Number of parts the split file has in total (1 for normal files). */
|
||||
totalParts: number;
|
||||
};
|
||||
|
||||
/** Merge split parts into one entry; other files stay as they are. Keeps first-seen order. */
|
||||
export function groupSplitFiles<T extends { path: string; size: number }>(files: T[]): FileGroup<T>[] {
|
||||
const groups: FileGroup<T>[] = [];
|
||||
const byBase = new Map<string, FileGroup<T>>();
|
||||
for (const f of files) {
|
||||
const info = splitInfo(f.path);
|
||||
if (!info) {
|
||||
groups.push({ path: f.path, parts: [f], size: f.size, totalParts: 1 });
|
||||
continue;
|
||||
}
|
||||
const key = `${info.base}#${info.total}`;
|
||||
let g = byBase.get(key);
|
||||
if (!g) {
|
||||
g = { path: info.base, parts: [], size: 0, totalParts: info.total };
|
||||
byBase.set(key, g);
|
||||
groups.push(g);
|
||||
}
|
||||
g.parts.push(f);
|
||||
g.size += f.size;
|
||||
}
|
||||
for (const g of groups) {
|
||||
if (g.parts.length > 1) g.parts.sort((a, b) => (splitInfo(a.path)?.part ?? 0) - (splitInfo(b.path)?.part ?? 0));
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
export type JobFileEntry = { path: string; expectedBytes: number; doneBytes: number; failed: boolean; parts: number };
|
||||
|
||||
/** Job progress per entry: split parts summed into one line. */
|
||||
export function groupJobFiles(files: { path: string; expectedBytes: number; doneBytes: number; state: string }[]): JobFileEntry[] {
|
||||
return groupSplitFiles(files.map((f) => ({ ...f, size: f.expectedBytes }))).map((g) => ({
|
||||
path: g.path,
|
||||
expectedBytes: g.size,
|
||||
doneBytes: g.parts.reduce((s, p) => s + p.doneBytes, 0),
|
||||
failed: g.parts.some((p) => p.state === "failed"),
|
||||
parts: g.totalParts,
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user