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
studio: show lm studio model names in chat (#9556)
Maheswar Kumar9ec6af98ef3d
diff --git a/studio/frontend/src/features/chat/local-model-options.ts b/studio/frontend/src/features/chat/local-model-options.tsindex 4ed02f1293f..01ad43d754f 100644--- a/studio/frontend/src/features/chat/local-model-options.ts+++ b/studio/frontend/src/features/chat/local-model-options.ts@@ -53,10 +53,7 @@ export function chatLocalModelOptions(model.source === "ollama" || model.path.toLowerCase().endsWith(".gguf");options.push({id: model.id,- name:- model.source === "lmstudio" && model.model_id- ? model.model_id- : model.display_name,+ name: model.display_name,baseModel: baseModelLabel(model.source),updatedAt: model.updated_at ?? undefined,source: "local" as const,diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsxindex aee92c224da..8bda5ffb14c 100644--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx@@ -50,6 +50,7 @@ import type { CommunityModelPolicy } from "./model-selector/audio-picker-policy"import type { CatalogGroup } from "./model-selector/model-catalog";import { HubModelPicker, hasDownloadedModels } from "./model-selector/pickers";import { PillTabs } from "./model-selector/pill-tabs";+import { loraOptionLabel } from "./model-selector/row-meta";import { isFineTunedSource } from "./model-selector/source-tabs";import type {DeletedModelRef,@@ -693,10 +694,7 @@ export function ModelSelector({all.set(model.id, model);}for (const lora of loraModels) {- // Strip "/ suffix" from display name (e.g. "foo_123/foo" → "foo_123")- const displayName = lora.name.includes("/")- ? lora.name.split("/")[0].trim()- : lora.name;+ const displayName = loraOptionLabel(lora);// Show type tag instead of base model nameconst isLocal = lora.source === "local";const isTraining = lora.source === "training";diff --git a/studio/frontend/src/features/model-picker/components/model-selector/row-meta.ts b/studio/frontend/src/features/model-picker/components/model-selector/row-meta.tsindex 96e4cdeca35..fc82c2ed6db 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/row-meta.ts+++ b/studio/frontend/src/features/model-picker/components/model-selector/row-meta.ts@@ -1,8 +1,11 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-// Pure helpers for model-row presentation: owner/name split, format pills,-// param chip, tabular size. No React/DOM deps so they stay easy to test.+// Pure helpers for model-row presentation: owner/name split, lora trigger+// label, format pills, param chip, tabular size. No React/DOM deps so they+// stay easy to test.++import type { LoraModelOption } from "./types";export type FormatTone = "gguf" | "mlx" | "checkpoint" | "adapter";@@ -40,6 +43,18 @@ export function isUnslothOwner(owner: string | null | undefined): boolean {return normalized === "unsloth" || normalized === "unslothai";}+/** Selector trigger label. Training and exported runs are named "<run>/<model>"+ * ("foo_123/foo"), so the run is the label; local inventory rows keep theirs,+ * since an Ollama repo name carries real slashes ("hf.co/unsloth/...:Q4_K_M"). */+export function loraOptionLabel(+ option: Pick<LoraModelOption, "name" | "source">,+): string {+ if (option.source === "local" || !option.name.includes("/")) {+ return option.name;+ }+ return option.name.split("/")[0].trim();+}+export type MetaToken =| { kind: "format"; label: string; tone: FormatTone }| { kind: "size"; label: string }diff --git a/studio/frontend/tests/chat-local-model-options.test.ts b/studio/frontend/tests/chat-local-model-options.test.tsindex f599b626b70..8aac26f455e 100644--- a/studio/frontend/tests/chat-local-model-options.test.ts+++ b/studio/frontend/tests/chat-local-model-options.test.ts@@ -78,16 +78,18 @@ test("hf_cache rows stay out of the local list", () => {assert.deepEqual(chatLocalModelOptions([row({ source: "hf_cache" })]), []);});-test("LM Studio rows prefer the model id and keep their label", () => {+test("LM Studio rows use the model name without the publisher folder", () => {+ const modelPath = "N:\\AI Models\\Qwen\\Qwen3.6-40B-Deck-Opus";const options = chatLocalModelOptions([row({- id: "/lm/x",+ id: modelPath,source: "lmstudio",- model_id: "publisher/model",- display_name: "x",+ model_id: "Qwen/Qwen3.6-40B-Deck-Opus",+ display_name: "Qwen3.6-40B-Deck-Opus",}),]);- assert.equal(options[0]?.name, "publisher/model");+ assert.equal(options[0]?.id, modelPath);+ assert.equal(options[0]?.name, "Qwen3.6-40B-Deck-Opus");assert.equal(options[0]?.baseModel, "LM Studio");});diff --git a/studio/frontend/tests/model-selector-trigger-label.test.ts b/studio/frontend/tests/model-selector-trigger-label.test.tsnew file mode 100644index 00000000000..75f8d2b570e--- /dev/null+++ b/studio/frontend/tests/model-selector-trigger-label.test.ts@@ -0,0 +1,98 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// The selector trigger names a lora by the segment before its first slash, so the+// training run shows rather than "<run>/<model>". Local inventory names carry real+// slashes, so the same strip left an Ollama row reading "hf.co". Pinned end to end:+// what Chat feeds the selector, and what the trigger then renders.++import assert from "node:assert/strict";+import test from "node:test";++import { registerBundlerResolver } from "./helpers/kit.ts";++registerBundlerResolver();++const { chatLocalModelOptions } = await import(+ "../src/features/chat/local-model-options.ts"+);++const { loraOptionLabel } = await import(+ "../src/features/model-picker/components/model-selector/row-meta.ts"+);++function localRow(over: Record<string, unknown> = {}) {+ return {+ id: "/models/demo",+ // biome-ignore lint/style/useNamingConvention: API schema+ display_name: "demo",+ path: "/models/demo",+ source: "models_dir",+ ...over,+ } as never;+}++test("a training or exported run is still named by its run prefix", () => {+ assert.equal(+ loraOptionLabel({ name: "foo_123/foo", source: "training" }),+ "foo_123",+ );+ assert.equal(+ loraOptionLabel({ name: "foo_123/foo", source: "exported" }),+ "foo_123",+ );+ assert.equal(+ loraOptionLabel({ name: "foo_123", source: "training" }),+ "foo_123",+ );+});++test("an LM Studio pick shows the model folder, not the publisher", () => {+ const options = chatLocalModelOptions([+ localRow({+ id: "N:\\AI Models\\Qwen\\Qwen3.6-40B-Deck-Opus",+ source: "lmstudio",+ // biome-ignore lint/style/useNamingConvention: API schema+ model_id: "Qwen/Qwen3.6-40B-Deck-Opus",+ // biome-ignore lint/style/useNamingConvention: API schema+ display_name: "Qwen3.6-40B-Deck-Opus",+ }),+ ]);+ const option = options[0];+ assert.ok(option);+ assert.equal(loraOptionLabel(option), "Qwen3.6-40B-Deck-Opus");+});++test("an Ollama pick keeps the slashes in its repo name", () => {+ // ollama pull hf.co/unsloth/Qwen3-8B-GGUF:Q4_K_M; repo_name keeps its host and+ // namespace for anything outside registry.ollama.ai/library.+ const options = chatLocalModelOptions([+ localRow({+ id: "ollama-manifest:%2Fhome%2Fu%2F.ollama%2Fmanifests%2Fhf.co%2Funsloth",+ source: "ollama",+ // biome-ignore lint/style/useNamingConvention: API schema+ model_format: "gguf",+ // biome-ignore lint/style/useNamingConvention: API schema+ display_name: "hf.co/unsloth/Qwen3-8B-GGUF:Q4_K_M (qwen3 Q4_K_M)",+ }),+ ]);+ const option = options[0];+ assert.ok(option);+ assert.equal(+ loraOptionLabel(option),+ "hf.co/unsloth/Qwen3-8B-GGUF:Q4_K_M (qwen3 Q4_K_M)",+ );++ const namespaced = chatLocalModelOptions([+ localRow({+ id: "ollama-manifest:%2Fhome%2Fu%2F.ollama%2Fmanifests%2Fsomeuser",+ source: "ollama",+ // biome-ignore lint/style/useNamingConvention: API schema+ model_format: "gguf",+ // biome-ignore lint/style/useNamingConvention: API schema+ display_name: "someuser/mymodel:latest",+ }),+ ])[0];+ assert.ok(namespaced);+ assert.equal(loraOptionLabel(namespaced), "someuser/mymodel:latest");+});