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: Search and Tools on by default for local models (#15644)
Michael Han43bc7c47bb1c
diff --git a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts b/studio/frontend/src/features/chat/stores/chat-runtime-store.tsindex 7c2d76403b5..c3a5891134a 100644--- a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts+++ b/studio/frontend/src/features/chat/stores/chat-runtime-store.ts@@ -1051,11 +1051,16 @@ function pendingSnapshotReadsLive(key: ClampedPillKey): boolean {);}+// Connections keep their own defaults in chat-page: hosted search and code execution are billed.+function pillDefault(key: ClampedPillKey): boolean {+ return key === "toolsEnabled" || key === "codeToolsEnabled";+}+function pillPreference(key: ClampedPillKey): boolean {return (pillOnRecord(key) ??loadOptionalBool(MIRRORED_SETTINGS[key].storageKey) ??- false+ pillDefault(key));}@@ -4156,11 +4161,11 @@ export const useChatRuntimeStore = create<ChatRuntimeStore>((set, get) => ({supportsBuiltinCodeExecution: false,supportsBuiltinImageGeneration: false,supportsBuiltinWebFetch: false,- toolsEnabled: loadBool(CHAT_TOOLS_ENABLED_KEY, false),+ toolsEnabled: loadBool(CHAT_TOOLS_ENABLED_KEY, pillDefault("toolsEnabled")),keepModelsLoaded: false,localImageModelReady: false,localVideoModelReady: false,- codeToolsEnabled: loadBool(CHAT_CODE_TOOLS_ENABLED_KEY, false),+ codeToolsEnabled: loadBool(CHAT_CODE_TOOLS_ENABLED_KEY, pillDefault("codeToolsEnabled")),codeToolsDeclinedUnderFullAccess: false,imageToolsEnabled: loadBool(CHAT_IMAGE_TOOLS_ENABLED_KEY, false),deepResearchEnabled: loadBool(CHAT_DEEP_RESEARCH_ENABLED_KEY, false),diff --git a/studio/frontend/tests/chat-tool-selection-lifecycle.test.ts b/studio/frontend/tests/chat-tool-selection-lifecycle.test.tsindex 7aa9f619906..f217c954793 100644--- a/studio/frontend/tests/chat-tool-selection-lifecycle.test.ts+++ b/studio/frontend/tests/chat-tool-selection-lifecycle.test.ts@@ -132,6 +132,8 @@ for (const scope of ["defaults", "chat", "pending chat"] as const) {test("unloading does not overwrite a settled chat or its defaults", async (t) => {const runtime = await boot(t);const store = runtime.useChatRuntimeStore;+ store.getState().setToolsEnabled(false);+ store.getState().setCodeToolsEnabled(false);store.getState().setActiveThreadId(THREAD);store.getState().applyThreadScopedSettings(THREAD, {toolsEnabled: true,@@ -534,11 +536,13 @@ test("Kimi keeps Search off and Thinking on when a chat opens without stored pilassert.equal(storage.get("unsloth_chat_tools_enabled"), "true");});-test("unloading drops a Search pill the provider lit without a stored preference", async (t) => {+test("unloading drops a Search pill the provider lit over the stored preference", async (t) => {const runtime = await boot(t);const store = runtime.useChatRuntimeStore;+ store.getState().setToolsEnabled(false);+ store.getState().setCodeToolsEnabled(false);store.setState({ toolsEnabled: true, codeToolsEnabled: true });- assert.equal(storage.get("unsloth_chat_tools_enabled"), undefined);+ assert.equal(storage.get("unsloth_chat_tools_enabled"), "false");store.getState().clearCheckpoint();assert.equal(store.getState().toolsEnabled, false);assert.equal(store.getState().codeToolsEnabled, false);@@ -766,9 +770,26 @@ test("a chat stored before the pill keys has no Search override of its own", asystore.getState().setActiveThreadId(THREAD);store.getState().applyThreadScopedSettings(THREAD, { permissionMode: "ask" });assert.equal(runtime.threadScopedOverride("toolsEnabled"), undefined);+ assert.equal(runtime.resolveToolsEnabledOnLoad(true).toolsEnabled, true);+ assert.equal(runtime.resolveToolsEnabledOnLoad(true).codeToolsEnabled, true);+ store.getState().setToolsEnabled(false);+ assert.equal(runtime.threadScopedOverride("toolsEnabled"), false);+});++test("a fresh profile starts with Search and Code on, and a stored choice wins", async (t) => {+ const runtime = await boot(t);+ const store = runtime.useChatRuntimeStore;+ assert.equal(storage.get("unsloth_chat_tools_enabled"), undefined);+ assert.equal(storage.get("unsloth_chat_code_tools_enabled"), undefined);+ assert.deepEqual(runtime.resolveToolsEnabledOnLoad(true), {+ toolsEnabled: true,+ codeToolsEnabled: true,+ deepResearchEnabled: false,+ });+ store.getState().setToolsEnabled(false);+ store.getState().setCodeToolsEnabled(false);assert.equal(runtime.resolveToolsEnabledOnLoad(true).toolsEnabled, false);- store.getState().setToolsEnabled(true);- assert.equal(runtime.threadScopedOverride("toolsEnabled"), true);+ assert.equal(runtime.resolveToolsEnabledOnLoad(true).codeToolsEnabled, false);});test("a same-model reload keeps the Search and Code pills the model was running with", () => {diff --git a/tests/studio/playwright_thread_scoped_settings.py b/tests/studio/playwright_thread_scoped_settings.pyindex 24e9e07958a..e6a7b5f4cdd 100644--- a/tests/studio/playwright_thread_scoped_settings.py+++ b/tests/studio/playwright_thread_scoped_settings.py@@ -359,13 +359,17 @@ def read_globals(page):)-def _wait_globals(page, expected):- """Polls up to 10 s for the Search default to read expected; on timeout the caller's check reports."""+def _wait_globals(+ page,+ expected,+ key = "unsloth_chat_tools_enabled",+):+ """Polls up to 10 s for a pill default to read expected; on timeout the caller's check reports."""try:wait_until(- lambda: read_globals(page)["unsloth_chat_tools_enabled"] == expected,+ lambda: read_globals(page)[key] == expected,timeout_s = 10,- what = f"the Search default to read {expected}",+ what = f"{key} to read {expected}",interval_s = 0.1,page = page,)@@ -476,6 +480,16 @@ def main():step("an unsaved chat still edits the installation defaults")# Plain /chat has a runtime-made thread id with no row; it must not count as an open chat.settle(page)+ # Search and Tools default on, and earlier tests share this home: pin both off first.+ for label, key in (+ ("Search", "unsloth_chat_tools_enabled"),+ ("Tools", "unsloth_chat_code_tools_enabled"),+ ):+ if pill(page, label).get_attribute("data-active") == "true":+ pill(page, label).click()+ _wait_globals(page, "false", key)+ if read_globals(page)[key] != "false":+ fail(f"turning {label} off never reached the defaults: {read_globals(page)!r}")pill(page, "Search").click()_wait_globals(page, "true")enabled_globals = read_globals(page)