Recommended files with a quant; floating selection bar

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>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-05 23:10:53 +02:00
1 parent 145818f149
commit 0247f257fb
16 files changed
+514 -27

No files matched your search

+17
View File
@@ -4,6 +4,7 @@ import { db } from "@/lib/db/client";
import { settings } from "@/lib/db/schema";
import { isLabelColor } from "@/lib/colors";
import { FILE_ROLE_ORDER, FILE_ROLES, type FileRole, type FileRoleStyles } from "@/lib/file-roles";
import { DEFAULT_RECOMMENDED_ROLES, RECOMMENDABLE_ROLES } from "@/lib/recommend";
const FILE_ROLES_KEY = "labels.fileRoles";
export const FILE_ROLE_LABEL_MAX = 24;
@@ -67,3 +68,19 @@ export async function saveFileRoleStyles(input: Record<string, { label?: unknown
await write(FILE_ROLES_KEY, stored);
return getFileRoleStyles();
}
const RECOMMENDED_KEY = "downloads.recommendedRoles";
/** File kinds picked automatically along with model weights (Settings → Downloads). */
export async function getRecommendedRoles(): Promise<FileRole[]> {
const stored = await read<unknown>(RECOMMENDED_KEY);
if (!Array.isArray(stored)) return DEFAULT_RECOMMENDED_ROLES;
return RECOMMENDABLE_ROLES.filter((r) => stored.includes(r));
}
export async function saveRecommendedRoles(roles: string[]): Promise<FileRole[]> {
const unknown = roles.find((r) => !RECOMMENDABLE_ROLES.includes(r as FileRole));
if (unknown) throw new SettingsError(`"${unknown}" can't be recommended.`);
await write(RECOMMENDED_KEY, RECOMMENDABLE_ROLES.filter((r) => roles.includes(r)));
return getRecommendedRoles();
}