Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Model picker: collapse a single downloaded quant again (#11190)
Michael Hane66a7cb2b952
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/sole-quant-cache.ts b/studio/frontend/src/features/model-picker/components/model-selector/sole-quant-cache.tsindex c9de320bcc4..d3d533d8798 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/sole-quant-cache.ts+++ b/studio/frontend/src/features/model-picker/components/model-selector/sole-quant-cache.ts@@ -21,21 +21,35 @@ export interface SoleQuantEntry<T> {quant: T | null;}-/** Collapse a Hub row only after a Hub-aware response verified every dependency. */-export function verifiedSoleHubVariant<T extends { downloaded?: boolean }>(+/** Collapse a Hub row only after a Hub-aware response verified every dependency.+ *+ * Counts the quants on disk, not the quants the repo offers. A dependency-aware answer is a+ * Hub answer, which lists every published quant, so counting listed quants never matched a+ * repo holding one. The local answer lists only what is on disk but cannot resolve+ * dependencies, so the two conditions could not hold together. */+export function verifiedSoleHubVariant<+ T extends {+ downloaded?: boolean;+ partial?: boolean;+ update_available?: boolean;+ pending_drafter_filename?: string | null;+ },+>(variants: readonly T[],resolvedLocally: boolean,dependenciesResolved: boolean,): T | null {- if (- resolvedLocally ||- !dependenciesResolved ||- variants.length !== 1 ||- variants[0].downloaded !== true- ) {- return null;- }- return variants[0];+ if (resolvedLocally || !dependenciesResolved) return null;+ // A torn quant keeps the expander, where resume lives.+ if (variants.some((v) => v.partial === true)) return null;+ const downloaded = variants.filter((v) => v.downloaded === true);+ if (downloaded.length !== 1) return null;+ const sole = downloaded[0];+ // Drafter still missing: not loadable yet, so not collapsible.+ if (sole.pending_drafter_filename) return null;+ // Only the expander carries the update action, so an update must keep it.+ if (sole.update_available === true) return null;+ return sole;}/** Identity of one repo's probe. Moves when that repo's variants cache is invalidated, the rowdiff --git a/studio/frontend/tests/sole-quant-cache.test.ts b/studio/frontend/tests/sole-quant-cache.test.tsindex 4a8c40a7c15..fcc000ca05c 100644--- a/studio/frontend/tests/sole-quant-cache.test.ts+++ b/studio/frontend/tests/sole-quant-cache.test.ts@@ -33,6 +33,95 @@ test("a sole Hub quant collapses only after dependency-aware verification", () =);});+// The shape a real cached repo has: a Hub answer lists every published quant while one is on+// disk. Counting listed quants instead made the collapse unreachable.+test("one quant on disk collapses even when the repo publishes many", () => {+ const quants = [+ "Q2_K",+ "Q3_K_M",+ "Q4_K_M",+ "Q5_K_M",+ "Q6_K",+ "Q8_0",+ "F16",+ "BF16",+ ];+ const variants = quants.map((quant) => ({+ quant,+ downloaded: quant === "Q4_K_M",+ }));++ const sole = verifiedSoleHubVariant(variants, false, true);+ assert.equal(sole?.quant, "Q4_K_M", "the one quant on disk is the sole quant");+});++test("a second quant on disk keeps the expander", () => {+ const variants = [+ { quant: "Q4_K_M", downloaded: true },+ { quant: "Q6_K", downloaded: true },+ { quant: "Q8_0", downloaded: false },+ ];+ assert.equal(verifiedSoleHubVariant(variants, false, true), null);+});++// Resume lives in the expander, so a torn quant keeps it even beside a clean sibling.+test("a torn quant beside a complete one keeps the expander", () => {+ const variants = [+ { quant: "Q4_K_M", downloaded: true },+ { quant: "Q6_K", downloaded: false, partial: true },+ ];+ assert.equal(verifiedSoleHubVariant(variants, false, true), null);+});++// Only GgufVariantExpander wires onUpdateVariant; the collapsed row's menu is pin and delete+// only, so collapsing an updateable quant would drop the update action from the default view.+test("an updateable quant keeps the expander", () => {+ const variants = [+ { quant: "Q4_K_M", downloaded: true, update_available: true },+ { quant: "Q6_K", downloaded: false },+ ];+ assert.equal(verifiedSoleHubVariant(variants, false, true), null);++ // No update pending still collapses.+ assert.equal(+ verifiedSoleHubVariant(+ [+ { quant: "Q4_K_M", downloaded: true, update_available: false },+ { quant: "Q6_K", downloaded: false },+ ],+ false,+ true,+ )?.quant,+ "Q4_K_M",+ );+});++// The companion concern behind the dependency gate, checked where it is answerable.+test("a cached main GGUF still awaiting its drafter keeps the expander", () => {+ const variants = [+ {+ quant: "Q4_K_M",+ downloaded: true,+ pending_drafter_filename: "gpt-oss-20b-MTP.gguf",+ },+ { quant: "Q6_K", downloaded: false },+ ];+ assert.equal(verifiedSoleHubVariant(variants, false, true), null);++ // Null/absent means nothing is pending, which must still collapse.+ assert.equal(+ verifiedSoleHubVariant(+ [+ { quant: "Q4_K_M", downloaded: true, pending_drafter_filename: null },+ { quant: "Q6_K", downloaded: false },+ ],+ false,+ true,+ )?.quant,+ "Q4_K_M",+ );+});+/** Two listed repos, each at its own cache version. */const targetsAt = (versionA: string, versionB: string): SoleQuantTarget[] => [{