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
// 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 { readSrc } from "./helpers/kit.ts";
import { readAudioWorkspaceSource } from "./helpers/audio-workspace.ts";
const source = readSrc("features/settings/tabs/voice-tab.tsx");
const en = readSrc("i18n/locales/en.ts");
const audioSource = readAudioWorkspaceSource();
test("the studio TTS row offers the Audio page it tells the user to use", () => {
// Settings is a modal, so it must close or Audio opens behind it.
assert.match(
source,
/label=\{t\("settings\.voice\.readAloud\.modelLabel"\)\}[\s\S]*?useSettingsDialogStore\.getState\(\)\.closeDialog\(\);[\s\S]{0,200}?void navigate\(\{\s*to: "\/audio",/,
);
assert.match(source, /t\("settings\.voice\.readAloud\.openAudioAction"\)/);
assert.match(en, /openAudioAction: "Open Audio",/);
});
test("the row lands on the TTS selector, not the mode Audio was left in", () => {
// AudioPage stays mounted and keeps its `mode`, so plain /audio can show the wrong selector.
assert.match(
source,
/to: "\/audio",\s*search: \{ task: "text-to-speech" \},/,
);
// Audio ignored a task without a model, so the task names the page via the busy gate.
assert.match(
audioSource,
/const urlWorkflow = audioRouteIntent\(routeSearch\);[\s\S]*?audioWorkflowUrlAction\(\{\s*urlWorkflow,/,
);
// A refused switch returns before navigating and keeps the parameter, so the retry rides the
// effect's busy dep; a successful one leaves only the page (the task is dropped).
assert.match(
audioSource,
/if \(!transitionWorkflow\(action\.workflow\)\) return;\s*lastSyncedWorkflow\.current = action\.workflow;[\s\S]{0,120}?void navigateSelf\(\{\s*to: "\/audio",\s*search: \{ workflow: action\.workflow \},\s*replace: true,\s*\}\);/,
);
assert.match(audioSource, /\}, \[\s*active,\s*busy,/);
});
test("custom TTS explains the strict voice default", () => {
assert.match(
en,
/customVoiceDescription: "Voice name the endpoint expects; defaults to alloy",/,
);
assert.doesNotMatch(en, /customVoiceDescription: .*optional/i);
});
test("a studio preview shows the generate wait instead of an idle button", () => {
assert.match(
source,
/markPreviewing\(true\);\s*setPreparingPreview\(true\);\s*try \{\s*const generate =[\s\S]*?const url = await generate\(/,
);
assert.match(
source,
/if \(controller\.signal\.aborted\) \{\s*releaseTtsAudioUrl\(url\);\s*return;\s*\}\s*setPreparingPreview\(false\);/,
);
// Every other exit goes through markPreviewing, so clearing there covers them all.
assert.match(
source,
/previewingRef\.current = value;\s*setPreviewing\(value\);[\s\S]*?if \(!value\) setPreparingPreview\(false\);/,
);
// Preparing outranks previewing: both are true during the wait.
assert.match(
source,
/\{preparingPreview \? \([\s\S]*?<Spinner[\s\S]*?preparingAction"\)\}[\s\S]*?\) : previewing \? \(/,
);
assert.match(en, /preparingAction: "Generating…",/);
});