Skip to content

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.

Studio images: keep the resident GGUF's base repo on Reapply and native reload (#14828)

Daniel Han505bbc24db4d
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 26ba6c4ea13..2425e4226a5 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -3599,6 +3599,7 @@ export function ImagesPage({
model_kind: status?.model_kind,
gguf_filename: status?.gguf_filename,
display_repo_id: status?.display_repo_id,
+ base_repo: status?.base_repo,
component_files: status?.component_files,
});
if (resident) lastLoad.current = resident;
diff --git a/studio/frontend/src/features/images/lib/engine-choice.ts b/studio/frontend/src/features/images/lib/engine-choice.ts
index 91fba3f7b3f..29a78f9f9d4 100644
--- a/studio/frontend/src/features/images/lib/engine-choice.ts
+++ b/studio/frontend/src/features/images/lib/engine-choice.ts
@@ -118,6 +118,13 @@ function baseRepoOf(status: ReloadStatus): { baseRepo?: string } {
return status.base_repo ? { baseRepo: status.base_repo } : {};
}
+/** The page's own GGUF target with the resident's base repo when it names none (one seeded from a status read that
+ * left it out), so the reload keeps the companions it runs with now. ``last`` itself otherwise. */
+function withResidentBase<T extends { kind?: string | null }>(last: T, status: ReloadStatus): T {
+ if (last.kind !== "gguf" || (last as { baseRepo?: string }).baseRepo || !status.base_repo) return last;
+ return { ...last, ...baseRepoOf(status) };
+}
+
/** The GGUF the native-reload note names: the page's own last load only while it is still the resident model (another
* client may have replaced it), else the checkpoint status reports. */
export function nativeReloadTarget<T extends { repoId: string; kind?: string | null; filename?: string | null }>(
@@ -126,7 +133,7 @@ export function nativeReloadTarget<T extends { repoId: string; kind?: string | n
): T | { repoId: string; kind: "gguf"; filename: string; displayRepoId?: string; baseRepo?: string } | null {
if (!status?.loaded || status.model_kind !== "gguf" || !status.repo_id || !status.gguf_filename) return null;
if (last && last.repoId === status.repo_id && last.kind === "gguf" && last.filename === status.gguf_filename) {
- return last;
+ return withResidentBase(last, status);
}
return {
repoId: status.repo_id,
@@ -219,7 +226,7 @@ export function reapplyTarget<T extends { repoId: string; kind?: string | null;
last.kind === status.model_kind &&
(last.kind === "pipeline" || last.filename === status.gguf_filename)
) {
- return last;
+ return withResidentBase(last, status);
}
return residentReloadTarget(status);
}
diff --git a/studio/frontend/tests/image-engine-choice.test.ts b/studio/frontend/tests/image-engine-choice.test.ts
index a7dfbe3459e..257e094329c 100644
--- a/studio/frontend/tests/image-engine-choice.test.ts
+++ b/studio/frontend/tests/image-engine-choice.test.ts
@@ -292,6 +292,33 @@ test("Reapply resolves its target against the checkpoint status reports", () =>
assert.match(source, /const l = reapplyTarget\(lastLoad\.current, status\);/);
});
+test("a reload of the resident GGUF keeps the base repo it was loaded with", () => {
+ const status = {
+ loaded: true,
+ model_kind: "gguf",
+ repo_id: "org/flux-gguf",
+ gguf_filename: "flux-Q4_K_M.gguf",
+ display_repo_id: null,
+ base_repo: "org/custom-base",
+ component_files: {},
+ };
+ const seeded = residentReloadTarget(status);
+ assert.equal(seeded?.baseRepo, "org/custom-base");
+ assert.equal(nativeReloadTarget(seeded, status)?.baseRepo, "org/custom-base");
+ assert.equal(reapplyTarget(seeded, status)?.baseRepo, "org/custom-base");
+ // A target seeded without it (an older page, or status that named none then) picks it up from status.
+ const bare = { repoId: "org/flux-gguf", kind: "gguf" as const, filename: "flux-Q4_K_M.gguf" };
+ assert.deepEqual(nativeReloadTarget(bare, status), { ...bare, baseRepo: "org/custom-base" });
+ assert.deepEqual(reapplyTarget(bare, status), { ...bare, baseRepo: "org/custom-base" });
+ // A base the page chose itself is kept, and a pipeline carries none.
+ const own = { ...bare, baseRepo: "org/other-base" };
+ assert.equal(reapplyTarget(own, status), own);
+ const pipe = { repoId: "org/P", kind: "pipeline" as const };
+ assert.equal(reapplyTarget(pipe, { loaded: true, model_kind: "pipeline", repo_id: "org/P", base_repo: "org/x" }), pipe);
+ const source = readSrc("features/images/images-page.tsx");
+ assert.match(source, /const resident = residentReloadTarget\(\{[\s\S]{0,300}base_repo: status\?\.base_repo,[\s\S]{0,120}\}\);/);
+});
+
test("a server pin never strips options: its native route falls back to diffusers when native cannot run", () => {
const advanced = { transformer_quant: "fp8", text_encoder_quant: "fp8", text_encoder_file: ["/m/te.safetensors"], vae_file: "/m/vae.safetensors" };
// The pin ignores the pick, and its fallback must build with the requested options.