Repository navigation
Studio: add an opt-in setting to read replies aloud automatically - #13357
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ts, stop it on chat switch
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 12, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 12, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 12, 2026
danielhanchen
added a commit
that referenced
this pull request
Oct 19, 2026
…#14191) ## Summary Fixes #9163 (its second ask, reading replies aloud automatically, shipped in #13357). Read aloud with an Unsloth Studio speech model could not run next to the chat model. On main, loading a TTS model in Audio unloaded the chat model, even with Keep multiple models loaded set to When they fit. The next chat message reloaded the chat model and unloaded the TTS model. And with both loaded, Read aloud still failed with "No speech model is loaded", because the request named no model and reached the chat model. The backend already supports both models loaded at once, so all fixes are in the frontend: - The Audio TTS load and the chat auto-load ("Loading last used model...") now send `alongside: true`. Under When they fit or Always, both models stay loaded. Off behaves as before, since the server ignores `alongside` there. - Read aloud looks up the loaded speech model in `/v1/models` and names it in `/audio/generate`. Audio page Generate does the same when its model sits beside the chat model. - The Audio page shows, generates with and ejects its own speech model, never the chat model. With only a chat model loaded, the header says "No TTS model loaded" instead of showing the chat model. Switching speech models unloads the old one first, so two TTS models don't pile up. - Every status read updates the Keep multiple models loaded mode, so a session that starts on the Audio page still knows it. Copy changes, in all 14 locales: - Settings > Voice: the engine option "Load TTS model" is now "Unsloth model" (Desktop shows these strings, so no "Unsloth Studio", per the Tauri branding contract), and the TTS model row says which model is loaded. Under Off, a new row explains that loading a speech model unloads the chat model and offers "Keep both loaded" (switches to When they fit). - Under Off, loading a TTS model in Audio says up front that it unloads the chat model, and the success toast has the same "Keep both loaded" action. - Loads that unload another model say which one. Read aloud errors point at Audio > Text to Speech (the old text said "Speak"). The Keep multiple models loaded description now mentions speech models. `generateStudioTtsAudio(text, signal)` keeps its signature, so it stays compatible with the Voice mode work in #12384. ## Testing Colab L4 (23 GB), Qwen3-1.7B UD-Q4_K_XL for chat, Kokoro-82M Q8_0 and KittenTTS for speech, headless Chrome driven by Playwright. Before the fix (main), these failed: - Off: loading Kokoro in Audio unloaded the chat model with no warning. The next chat message reloaded chat and unloaded Kokoro, then Read aloud failed with "No speech model is loaded". - When they fit: loading Kokoro still unloaded the chat model, and the chat reload still unloaded Kokoro. - With both loaded (simulated `alongside`), Read aloud returned 400 "No speech model is loaded". After the fix (main 2fee36f + this branch), these passed: - Off: the load toast warns that the chat model will be unloaded, the success toast names it, and "Keep both loaded" in Settings > Voice switches to When they fit. - When they fit, chat loaded first: loading Kokoro in Audio keeps both. The Audio header shows Kokoro, and Generate sends `model=Kokoro` and returns 200. - When they fit, Kokoro loaded first: the chat auto-load sends `alongside: true` and both stay loaded. Read aloud sends `model=Kokoro` and returns 200. - Ejecting in Audio unloads only the speech model. Switching Kokoro to KittenTTS unloads Kokoro, then loads KittenTTS beside chat. - Cold page load on `/audio` under When they fit: loading Kokoro keeps chat loaded, and Read aloud on a chat reply returns 200. Local checks: ```bash cd studio/frontend npm test # 12,677 tests: 12,676 pass, 0 fail, 1 skipped npm run typecheck npm run i18n:check:strict npx vite build npx eslint <touched files> # no new findings vs base npm run bundle:check ``` `bundle:check` is over budget on main too (2005.9 KB vs 2003.5 KB). This change adds about 0.6 KB transfer. New and updated tests: `read-aloud-beside-chat.test.ts`, `audio-page-policy.test.ts`, `read-aloud-studio-voice.test.ts`, `openai-model-catalog.test.ts`, `audio-run-api.test.ts`, `tts-custom-connections-disabled.test.ts`. Not tested: Always mode, transformers (non-audio.cpp) TTS models, saved or cloned voices, Windows, macOS, the desktop app, and audible playback (checked by HTTP 200 and the WAV payload only). ## Before and after Two isolated Studio installs (merge base `2fee36ffa` vs this branch), CPU only, Keep multiple models loaded set to When they fit, with Qwen3-0.6B Q4_K_M for chat and Kokoro-82M Q8_0 for speech loaded together. Audio page: main shows the chat model ("The loaded model is not a TTS audio model"), this branch shows Kokoro.  Read aloud on a chat reply: main sends no model and gets 400 "No model loaded.", this branch sends `model=audio-cpp/audio.cpp-gguf/Kokoro-82M-GGUF` and gets 200.  Settings > Voice under Off, after loading Kokoro: the engine option is now "Unsloth model" (shot before it lost "Studio" for the Desktop branding contract, so the image still reads "Unsloth Studio model"), the TTS model row names the loaded model, and a row offers "Keep both loaded".  --------- Co-authored-by: Daniel Han <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12303
Summary
Read aloud in Studio and Desktop only works through the speaker button on each reply, so hands-free use needs a click after every message. This adds an opt-in Read replies automatically switch under Settings > Voice > Read aloud. When it is on, each reply is read aloud as soon as it finishes.
This is opt-in. The switch is off by default (
autoReadAloud: false), and only a savedtrueturns it on, so existing and new users hear nothing new unless they flip it. Read aloud keeps working exactly as today: one click on the speaker icon per reply.What it does
message.speak()throughStudioSpeechSynthesisAdapter), so it honours the chosen TTS engine (system voices, the Studio speech model, or a custom connection), voice, speed, pitch and volume, and the existing markdown stripping.runEndcan fire before the final message state lands, so a reply that is still settling is retried once its status updates, and a reply is never spoken twice.Changes
voice-settings-store.ts:autoReadAloud(defaultfalse), persisted with the other voice settings.voice-tab.tsx: the new switch, right under the Read aloud button switch; added to Settings search.auto-read-aloud.tsx: a small headless component mounted in the chat thread (not in Compare panes).utils/auto-read-aloud.ts: the decision of whether to speak, wait or skip, kept pure so it is unit tested.i18n:check:strictpasses).Tests
tests/auto-read-aloud.test.ts: speaks a finished reply, waits on a settling one, skips stopped, failed, cut-off, tool-approval, reasoning-only and empty replies, checks the opt-in default, that Compare panes do not mount it, that a hidden chat stays silent and that leaving a chat stops its own playback. The cut-off case fails with the check removed.npm run typecheck,npm run i18n:check:strict,npm test(11332 passed, 0 failed) andnpm run buildall pass.Before / after
Settings > Voice > Read aloud on a fresh install. The new switch sits under the Read aloud button switch and is off by default (main on the left, this branch on the right):
The same scripted reply on both sides after turning the setting on. On this branch the finished reply is sent to the speech engine and its speaker icon turns into Stop reading; on main nothing is spoken: