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 a decision with the trained model after Use in Decision API (#12953)

Nilay9d3242041fa6
diff --git a/studio/frontend/src/features/settings/components/decision-api-section.tsx b/studio/frontend/src/features/settings/components/decision-api-section.tsx
index ae5ee6a5a5e..cad0caade98 100644
--- a/studio/frontend/src/features/settings/components/decision-api-section.tsx
+++ b/studio/frontend/src/features/settings/components/decision-api-section.tsx
@@ -97,12 +97,25 @@ export function DecisionApiSection(): ReactElement | null {
} | null>(null);
const [busy, setBusy] = useState(false);
const [tryOpen, setTryOpen] = useState(false);
+ const [tryModel, setTryModel] = useState<string | undefined>();
const [error, setError] = useState<string | null>(null);
const sectionRef = useRef<HTMLElement | null>(null);
const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);
+ const decisionTryRequested = useSettingsDialogStore(
+ (s) => s.decisionTryRequested,
+ );
const enabled = settings?.enabled ?? false;
if (tryOpen && !enabled) setTryOpen(false);
+
+ useEffect(() => {
+ if (!decisionTryRequested || !settings) return;
+ useSettingsDialogStore.getState().consumeDecisionTryRequest();
+ if (settings.enabled && settings.model === decisionTryRequested) {
+ setTryModel(decisionTryRequested);
+ setTryOpen(true);
+ }
+ }, [decisionTryRequested, settings]);
const model = settings?.model ?? null;
const backend = settings?.backend ?? "auto";
// llama.cpp serves a GGUF, PyTorch the safetensors: the download follows the runtime.
@@ -712,6 +725,7 @@ export function DecisionApiSection(): ReactElement | null {
<DecisionTryDialog
open={tryOpen && enabled}
onOpenChange={setTryOpen}
+ initialModel={tryModel}
settings={settings}
connections={connections ?? []}
onRun={() => {
diff --git a/studio/frontend/src/features/settings/components/decision-try-dialog.tsx b/studio/frontend/src/features/settings/components/decision-try-dialog.tsx
index fd4d1a9230b..9929edff5c9 100644
--- a/studio/frontend/src/features/settings/components/decision-try-dialog.tsx
+++ b/studio/frontend/src/features/settings/components/decision-try-dialog.tsx
@@ -36,9 +36,9 @@ import {
BookOpen01Icon,
Cancel01Icon,
CodeIcon,
- EyeIcon,
PlayIcon,
SlidersHorizontalIcon,
+ ViewIcon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";
import {
@@ -802,12 +802,14 @@ function ModelPicker({
export function DecisionTryDialog({
open,
onOpenChange,
+ initialModel,
settings,
connections,
onRun,
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
+ initialModel?: string;
settings: SystemOneSettings;
connections: SystemOneConnection[];
onRun: () => void;
@@ -817,7 +819,7 @@ export function DecisionTryDialog({
const [type, setType] = useState<DecisionType>("noul");
const [drafts, setDrafts] =
useState<Record<DecisionType, DecisionDraft>>(initialDrafts);
- const [model, setModel] = useState(DEFAULT_MODEL);
+ const [model, setModel] = useState(initialModel ?? DEFAULT_MODEL);
const [inputView, setInputView] = useState<InputView>("form");
const [outputView, setOutputView] = useState<OutputView>("preview");
const [jsonText, setJsonText] = useState("");
@@ -842,6 +844,10 @@ export function DecisionTryDialog({
if (open) return stop;
}, [open, stop]);
+ useEffect(() => {
+ if (open && initialModel) setModel(initialModel);
+ }, [open, initialModel]);
+
const request = useMemo(
() => buildRequest(type, draft, model),
[type, draft, model],
@@ -1250,7 +1256,7 @@ export function DecisionTryDialog({
{
id: "preview",
label: t("decisions.preview"),
- icon: EyeIcon,
+ icon: ViewIcon,
},
{ id: "json", label: t("decisions.json"), icon: CodeIcon },
]}
diff --git a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts b/studio/frontend/src/features/settings/stores/settings-dialog-store.ts
index c5712b69747..8227c148995 100644
--- a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts
+++ b/studio/frontend/src/features/settings/stores/settings-dialog-store.ts
@@ -73,6 +73,7 @@ interface SettingsDialogState {
// Set when something asks for one connection's settings (the picker's Connected group gear).
// ConnectionsTab hands it to the form, then clears it. Same lifetime as archivedRequested.
connectionRequested: string | null;
+ decisionTryRequested: string | null;
openDialog: (tab?: SettingsTab, options?: OpenDialogOptions) => void;
openArchivedChats: () => void;
openArchivedMedia: (shelf: Exclude<ArchivedShelf, "chats">) => void;
@@ -82,6 +83,8 @@ interface SettingsDialogState {
openLogs: (family?: string, sourcePath?: string | null) => void;
consumeLogFamilyRequest: () => void;
consumeConnectionRequest: () => void;
+ openDecisionTry: (model: string) => void;
+ consumeDecisionTryRequest: () => void;
consumeScrollTarget: (target: SettingsScrollTarget) => void;
closeDialog: () => void;
setActiveTab: (tab: SettingsTab) => void;
@@ -209,6 +212,7 @@ export const useSettingsDialogStore = create<SettingsDialogState>((set) => ({
logSourcePathRequested: null,
logRequestSeq: 0,
connectionRequested: null,
+ decisionTryRequested: null,
openDialog: (requestedTab, options) =>
set((state) => {
const { tab, target } = resolveScrollRequest(requestedTab, options?.scrollTarget);
@@ -275,6 +279,19 @@ export const useSettingsDialogStore = create<SettingsDialogState>((set) => ({
consumeLogFamilyRequest: () =>
set({ logFamilyRequested: null, logSourcePathRequested: null }),
consumeConnectionRequest: () => set({ connectionRequested: null }),
+ openDecisionTry: (model) =>
+ set((state) => ({
+ open: true,
+ activeTab: "api-keys",
+ scrollTarget: "api-keys-decision-api",
+ archivedRequested: null,
+ logFamilyRequested: null,
+ logSourcePathRequested: null,
+ connectionRequested: null,
+ decisionTryRequested: model,
+ ...focusForOpen(state),
+ })),
+ consumeDecisionTryRequest: () => set({ decisionTryRequested: null }),
consumeScrollTarget: (target) =>
set((state) => ({
scrollTarget: state.scrollTarget === target ? null : state.scrollTarget,
@@ -290,6 +307,7 @@ export const useSettingsDialogStore = create<SettingsDialogState>((set) => ({
logFamilyRequested: null,
logSourcePathRequested: null,
connectionRequested: null,
+ decisionTryRequested: null,
}),
setActiveTab: (tab) => {
try {
diff --git a/studio/frontend/src/features/studio/sections/progress-section.tsx b/studio/frontend/src/features/studio/sections/progress-section.tsx
index e1505b42452..2513b3e032a 100644
--- a/studio/frontend/src/features/studio/sections/progress-section.tsx
+++ b/studio/frontend/src/features/studio/sections/progress-section.tsx
@@ -23,7 +23,10 @@ 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 } from "@/features/settings";
+import {
+ updateSystemOneSettings,
+ useSettingsDialogStore,
+} from "@/features/settings";
import {
getTrainingMethodLabel,
type TrainingViewData,
@@ -187,10 +190,9 @@ export function ProgressSection({
}
setEnablingDecisionApi(true);
try {
- await updateSystemOneSettings({
- enabled: true,
- model: `laya-ft:${exportRunName}`,
- });
+ const model = `laya-ft:${exportRunName}`;
+ await updateSystemOneSettings({ enabled: true, model });
+ useSettingsDialogStore.getState().openDecisionTry(model);
toast.success(
t("studio.progress.decisionApiEnabled", { name: exportRunName }),
);
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index 35299a57bc3..e0426989356 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -4152,7 +4152,7 @@ export const en = {
},
decisions: {
title: "Try a decision",
- description: "Ask Laya a question about any text.",
+ description: "Ask decision model a question about any text.",
tryIt: "Try it",
tryItOff: "Turn on Serve requests to try it.",
typeNoul: "Yes / no",