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: open Try after Use in Decision API for Clef and LLM fine-tunes (#16497)

Nilay55b6890944d8
diff --git a/studio/backend/tests/test_decision_serving.py b/studio/backend/tests/test_decision_serving.py
index 56500e1ebad..18509155033 100644
--- a/studio/backend/tests/test_decision_serving.py
+++ b/studio/backend/tests/test_decision_serving.py
@@ -408,7 +408,10 @@ def test_a_clef_fine_tune_serves_through_its_worker(home, client, clef):
served = _clef_fine_tune(home, "clef_served_1")
assert _listed(client) == [served]
# The trainer's "Use in Decision API" names every run laya-ft:; the layout picks the prefix.
- assert _put(client, enabled = True, model = "laya-ft:clef_served_1").status_code == 200
+ put = _put(client, enabled = True, model = "laya-ft:clef_served_1")
+ assert put.status_code == 200
+ # The trainer opens Try under the PUT answer's name.
+ assert put.json()["model"] == served
assert client.get("/api/settings/systemone").json()["model"] == served
answer = _post(client).json()
diff --git a/studio/frontend/src/features/settings/api/systemone.ts b/studio/frontend/src/features/settings/api/systemone.ts
index 6a5e5fa4fb7..480569984bc 100644
--- a/studio/frontend/src/features/settings/api/systemone.ts
+++ b/studio/frontend/src/features/settings/api/systemone.ts
@@ -7,6 +7,7 @@ import {
readFastApiError,
} from "@/lib/format-fastapi-error";
import type { DecisionResponse } from "../lib/decision-request";
+import { useSettingsDialogStore } from "../stores/settings-dialog-store";
export type SystemOneDevice = "cpu" | "gpu";
export type SystemOneBackend = "auto" | "llama.cpp" | "mlx" | "pytorch";
@@ -243,6 +244,14 @@ export async function updateSystemOneSettings(
);
}
+export async function tryFineTuneInDecisionApi(runName: string): Promise<void> {
+ const { model } = await updateSystemOneSettings({
+ enabled: true,
+ model: `laya-ft:${runName}`,
+ });
+ useSettingsDialogStore.getState().openDecisionTry(model);
+}
+
export async function validateSystemOneSettings(
patch: SystemOneSettingsPatch,
): Promise<void> {
diff --git a/studio/frontend/src/features/settings/index.ts b/studio/frontend/src/features/settings/index.ts
index 42dac371abf..9b5be6720c6 100644
--- a/studio/frontend/src/features/settings/index.ts
+++ b/studio/frontend/src/features/settings/index.ts
@@ -26,6 +26,7 @@ export { listOpenAIModels } from "./api/openai-models";
export {
loadSystemOneSettings,
subscribeSystemOneSettings,
+ tryFineTuneInDecisionApi,
updateSystemOneSettings,
} from "./api/systemone";
export { DECISION_MODEL_LABELS } from "./lib/decision-model-labels";
diff --git a/studio/frontend/src/features/studio/sections/progress-section.tsx b/studio/frontend/src/features/studio/sections/progress-section.tsx
index 505627450f5..d95a3b252fd 100644
--- a/studio/frontend/src/features/studio/sections/progress-section.tsx
+++ b/studio/frontend/src/features/studio/sections/progress-section.tsx
@@ -23,10 +23,7 @@ import { usePlatformStore } from "@/config/env";
import { MLX_OPTIMIZER_OPTIONS, OPTIMIZER_OPTIONS } from "@/config/training";
import { useIsAccountOwner } from "@/features/auth";
import { setTrainingCompareHandoff } from "@/features/chat";
-import {
- updateSystemOneSettings,
- useSettingsDialogStore,
-} from "@/features/settings";
+import { tryFineTuneInDecisionApi } from "@/features/settings";
import {
getTrainingMethodLabel,
type TrainingViewData,
@@ -193,9 +190,7 @@ export function ProgressSection({
}
setEnablingDecisionApi(true);
try {
- const model = `laya-ft:${exportRunName}`;
- await updateSystemOneSettings({ enabled: true, model });
- useSettingsDialogStore.getState().openDecisionTry(model);
+ await tryFineTuneInDecisionApi(exportRunName);
toast.success(
t("studio.progress.decisionApiEnabled", { name: exportRunName }),
);
diff --git a/studio/frontend/tests/decision-fine-tune-try.test.ts b/studio/frontend/tests/decision-fine-tune-try.test.ts
new file mode 100644
index 00000000000..167e8e1ea98
--- /dev/null
+++ b/studio/frontend/tests/decision-fine-tune-try.test.ts
@@ -0,0 +1,64 @@
+// 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, { afterEach } from "node:test";
+
+import {
+ installLocalStorageFake,
+ registerStoreStubResolver,
+} from "./helpers/kit.ts";
+
+registerStoreStubResolver();
+installLocalStorageFake();
+Object.assign(window, { dispatchEvent: () => true });
+Object.assign(globalThis, { HTMLElement: class {} });
+
+const { setAuthFetchHandler } = await import("./helpers/store-stubs/auth.ts");
+const { tryFineTuneInDecisionApi } = await import(
+ "../src/features/settings/api/systemone.ts"
+);
+const { useSettingsDialogStore } = await import(
+ "../src/features/settings/stores/settings-dialog-store.ts"
+);
+
+function backendStoring(model: string) {
+ const sent: { model?: string; enabled?: boolean }[] = [];
+ setAuthFetchHandler((_input, init) => {
+ sent.push(JSON.parse(String(init?.body)));
+ return Response.json({ enabled: true, model, models: [] });
+ });
+ return sent;
+}
+
+afterEach(() => {
+ setAuthFetchHandler(null);
+ useSettingsDialogStore.setState({ decisionTryRequested: null, open: false });
+});
+
+test("a Clef run opens Try under the name the backend stored", async () => {
+ const sent = backendStoring("clef-ft:clef_run_1");
+ await tryFineTuneInDecisionApi("clef_run_1");
+ assert.equal(sent[0].model, "laya-ft:clef_run_1");
+ assert.equal(sent[0].enabled, true);
+ const state = useSettingsDialogStore.getState();
+ assert.equal(state.decisionTryRequested, "clef-ft:clef_run_1");
+ assert.equal(state.open, true);
+});
+
+test("a Laya run still opens Try under its own name", async () => {
+ backendStoring("laya-ft:laya_run_1");
+ await tryFineTuneInDecisionApi("laya_run_1");
+ assert.equal(
+ useSettingsDialogStore.getState().decisionTryRequested,
+ "laya-ft:laya_run_1",
+ );
+});
+
+test("Try stays closed when the backend refuses the model", async () => {
+ setAuthFetchHandler(() =>
+ Response.json({ detail: "Unknown Decision API model" }, { status: 400 }),
+ );
+ await assert.rejects(tryFineTuneInDecisionApi("gone"));
+ assert.equal(useSettingsDialogStore.getState().decisionTryRequested, null);
+});