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: exclude diffusion models from Chat's On Device list (#15336)

Daniel Han8cc9e012990b
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/model-capabilities.ts b/studio/frontend/src/features/model-picker/components/model-selector/model-capabilities.ts
index ddb738598a6..33de839a8d5 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/model-capabilities.ts
+++ b/studio/frontend/src/features/model-picker/components/model-selector/model-capabilities.ts
@@ -42,6 +42,13 @@ const VIDEO_GEN_TAGS = new Set([
"image-text-to-video",
]);
+export function isDiffusionTask(task: string | null | undefined): boolean {
+ return (
+ task === "image-diffusion-unsupported" ||
+ (task != null && (IMAGE_GEN_TAGS.has(task) || VIDEO_GEN_TAGS.has(task)))
+ );
+}
+
const SEP = "(?:^|[-_/. ])";
const END = "(?=$|[-_/. ])";
const VISION_NAME_RE = new RegExp(
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
index fb7d7a8a060..19de73956d7 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
@@ -203,6 +203,7 @@ import { localGgufKindFor } from "./local-gguf-policy";
import {
type ModelCapabilities,
detectCapabilities,
+ isDiffusionTask,
} from "./model-capabilities";
import {
AUDIO_CATALOG,
@@ -2619,9 +2620,6 @@ export const AUDIO_GEN_TASKS = [
"audio-to-audio",
] as const;
-// Diffusion GGUF archs the Images backend cannot assemble yet; they would 400 on load.
-const UNSUPPORTED_DIFFUSION_TASK = "image-diffusion-unsupported";
-
const MEDIA_PAGE_TASKS: readonly string[] = [
...IMAGE_GEN_TASKS,
...VIDEO_GEN_TASKS,
@@ -2697,8 +2695,8 @@ function passesTaskGate(
!(!taskFilterHasAudio(filter) && isImageEditModel(repoId))
) || localModel?.opaque === true;
}
- // Unfiltered (chat): diffusion models stay listed and route to their page.
- return repoTask !== UNSUPPORTED_DIFFUSION_TASK;
+ // Chat hides diffusion models; Images/Video own them.
+ return !isDiffusionTask(repoTask);
}
let _cachedGgufCache: CachedGgufRepo[] = [];
@@ -4289,7 +4287,7 @@ export function HubModelPicker({
catalogSeedRows,
]);
- // Supported diffusion GGUFs stay listed so a pick routes to Images or Video.
+ // Ordered by the On Device dropdown (Recent / Size / Name / Downloaded).
const sortedCachedGguf = useMemo(
() =>
sortCachedRepos(
diff --git a/studio/frontend/tests/chat-on-device-diffusion.test.ts b/studio/frontend/tests/chat-on-device-diffusion.test.ts
new file mode 100644
index 00000000000..62175279893
--- /dev/null
+++ b/studio/frontend/tests/chat-on-device-diffusion.test.ts
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+import { isDiffusionTask } from "../src/features/model-picker/components/model-selector/model-capabilities.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+const pickerSource = readSrc("features/model-picker/components/model-selector/pickers.tsx");
+
+function taskList(name: string): string[] {
+ const match = pickerSource.match(new RegExp(`export const ${name} = \\[([\\s\\S]*?)\\] as const;`));
+ assert.ok(match, name);
+ return [...match[1].matchAll(/"([^"]+)"/g)].map((m) => m[1]);
+}
+
+test("Chat excludes both downloaded FLUX formats while keeping text and VLMs", () => {
+ const cached = [
+ { id: "unsloth/flux-3-image-klein-pup-GGUF", task: "text-to-image" },
+ { id: "unsloth/flux-3-image-klein-FP8", task: "text-to-image" },
+ { id: "unsloth/NVIDIA-Nemotron-3.5-Bolt-E4B-GGUF", task: "text-generation" },
+ { id: "unsloth/Qwen3.5-2B", task: "image-text-to-text" },
+ ];
+ assert.deepEqual(cached.filter((row) => !isDiffusionTask(row.task)).map((row) => row.id), [
+ "unsloth/NVIDIA-Nemotron-3.5-Bolt-E4B-GGUF",
+ "unsloth/Qwen3.5-2B",
+ ]);
+});
+
+test("image, editing and video generation tasks stay out of Chat", () => {
+ for (const task of [
+ "text-to-image", "image-to-image", "image-text-to-image", "inpainting",
+ "text-to-video", "image-to-video", "image-text-to-video", "image-diffusion-unsupported",
+ ]) {
+ assert.equal(isDiffusionTask(task), true, task);
+ }
+});
+
+test("unknown metadata and existing audio routing retain their behavior", () => {
+ for (const task of [undefined, null, "text-generation", "image-text-to-text", "text-to-speech"]) {
+ assert.equal(isDiffusionTask(task), false, String(task));
+ }
+});
+
+test("every task the Images and Video pickers own is kept out of Chat", () => {
+ const owned = [...taskList("IMAGE_GEN_TASKS"), ...taskList("VIDEO_GEN_TASKS")];
+ assert.ok(owned.length >= 6);
+ for (const task of owned) assert.equal(isDiffusionTask(task), true, task);
+});
+
+test("the unfiltered task gate drops diffusion rows and the filtered branch is untouched", () => {
+ const start = pickerSource.indexOf("function passesTaskGate(");
+ assert.ok(start >= 0);
+ const body = pickerSource.slice(start, pickerSource.indexOf("\n}\n", start));
+ const filtered = body.indexOf("if (filter) {");
+ assert.ok(filtered >= 0);
+ assert.match(body, /taskMatchesFilter\(repoTask, filter\)/);
+ assert.match(body.slice(body.lastIndexOf("}")), /return !isDiffusionTask\(repoTask\);/);
+});
+
+test("all five On Device lists go through the task gate", () => {
+ for (const list of [
+ "sortedCachedGguf",
+ "sortedCachedModels",
+ "sortedLmStudio",
+ "sortedLocalDir",
+ "sortedCustomFolderModels",
+ ]) {
+ const start = pickerSource.indexOf(`const ${list} = useMemo(`);
+ assert.ok(start >= 0, list);
+ const end = pickerSource.indexOf("const ", start + 20);
+ assert.match(pickerSource.slice(start, end), /passesTaskGate\(/, list);
+ }
+});
diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.py
index 9215df5e99b..8e7213b6237 100644
--- a/tests/studio/test_model_picker_contracts.py
+++ b/tests/studio/test_model_picker_contracts.py
@@ -1962,12 +1962,16 @@ def test_local_model_sections_respect_the_task_filter():
def test_chat_picker_routes_diffusion_picks_to_their_page():
- """Chat cannot load a diffusion or audio model. Rather than hiding an on-device one or
- letting it 400, the unfiltered picker routes the pick to the page that loads it."""
+ """Chat cannot load a diffusion or audio model. The unfiltered picker hides on-device diffusion
+ rows (Images / Video list them; #15336), and a pick that still reaches it routes to its page."""
src = _read("features/model-picker/components/model-selector/pickers.tsx")
gate = re.search(r"function passesTaskGate\(.*?\n\}", src, re.S)
assert gate, "passesTaskGate not found"
- assert "UNSUPPORTED_DIFFUSION_TASK" in gate.group(0)
+ assert "!isDiffusionTask(repoTask)" in gate.group(0)
+ caps = _read("features/model-picker/components/model-selector/model-capabilities.ts")
+ assert (
+ 'task === "image-diffusion-unsupported"' in caps
+ ), "the never-loadable tag must stay hidden"
wrapper = re.search(r"const onSelect = useCallback\(.*?\n \);", src, re.S)
assert wrapper, "the routing wrapper around onSelect is missing"
body = wrapper.group(0)