Skip to content

Studio: keep the Read aloud speech model loaded beside the chat model - #14191

Merged
danielhanchen merged 15 commits into
unslothai:mainfrom
Etherll:fix/inline-read-aloud-keep-tts-ab4ce7dccabb
Oct 19, 2026
Merged

danielhanchen merged 15 commits into
unslothai:mainfrom
Etherll:fix/inline-read-aloud-keep-tts-ab4ce7dccabb

Conversation

@Etherll

@Etherll Etherll commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

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:

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.

Audio page header

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.

Read aloud on a chat reply

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".

Settings Voice tab under Off

Read aloud with an Unsloth Studio speech model could not stay loaded next to
the chat model. Loading a TTS model on the Audio page replaced the chat model,
even with Keep multiple models loaded set to When they fit; the chat model's
automatic reload then replaced the TTS model; and Read aloud named no model, so
it reached the chat model and failed with "No speech model is loaded" even when
both were loaded.

- Audio TTS loads and the chat auto-loads send alongside, so both stay loaded
  under When they fit or Always. Off is unchanged.
- Read aloud and Audio generation name the loaded speech model when it sits
  beside the chat model.
- The Audio page shows, generates with and ejects its own speech model, never
  the chat model, and switching speech models unloads the old one first.
- Keep multiple models loaded is read from every status, so a session that
  never opened Chat or Settings still knows it.
- Settings > Voice: the engine reads "Unsloth Studio model", the TTS model row
  shows the loaded model, and under Off a row explains the trade-off with a
  "Keep both loaded" action. The Audio load toast says the same.
- Loads say what they unloaded; read-aloud errors point at Audio > Text to
  Speech; memory settings copy mentions speech models. All 14 locales.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-19T12:23:46.097949Z 1a177f8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

- Read aloud showed "[object Object]" when the named speech model had been
  unloaded: the refusal nests its message ({detail: {error: {message}}}), so
  read it with formatApiErrorBody like other routes.
- With a saved voice, a loaded clone-only speech model now counts for read
  aloud (the server runs a saved voice as a clone).
- The Audio page lost a speech model kept beside the chat model once the chat
  model was ejected (a kept model is never promoted); it now probes the kept
  models whenever the active model is not audio.
- Switching speech models unloads the old one only after the new one loads, so
  a failed load keeps it.
- A speech load kept beside the chat model, and ejecting a kept speech model,
  no longer ask to stop running chats or cancel queued prompts, as Chat's own
  keep-others load does.
- A speech load kept beside the chat model, and ejecting a speech model while
  the chat model stays loaded, no longer stop the local chat prompt queues:
  an empty requestLocalPromptQueueStop still stops every local queue.
- Ejecting a speech model that is the active model with the chat model kept
  beside it is handled like ejecting a kept one: no question, no queue stop.
- The Audio page routes, generates with and ejects a kept speech model by the
  id it was found under (a local model's path), not the short name its status
  shows, which a chat or other local model can share.
When a custom-folder speech model is the active model with the chat model kept
beside it, its status names it by the file stem. Switching speech models
unloaded it by that name, which may not match it or may match another model;
use its model_identifier (the path) instead.
Two local GGUFs can share a file stem. The Audio page skipped every serving
entry with the active model's name, so a speech model kept beside a chat model
of the same stem was missed; skip only the active model's own checkpoint.
@danielhanchen danielhanchen self-assigned this Oct 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbccc70e02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

// Read aloud is not a Speak run, so it stays out of Speak's history.
persist: false,
max_tokens: TTS_MAX_TOKENS,
...(model ? { model } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route read aloud by the speech slot's checkpoint

When the primary chat model and a kept TTS model are local GGUFs with the same file stem (for example /models/chat/Voice.gguf and /models/tts/Voice.gguf), /v1/models represents them with the same path-free id and loadedSpeechModelId returns Voice. The backend gives the primary slot precedence for that id, so this named request routes back to the chat model and is rejected as “not an audio model” even though the TTS slot is loaded. Resolve read aloud with the slot's serving_checkpoints identifier, as describeAudioSlot already does, instead of the catalog id.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing: it needs a chat GGUF and a TTS GGUF with the same file stem from different local folders, which is outside the cases this targets; Hub and catalog models have distinct ids.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 382fcc4d32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +332 to +335
const replacesChat =
!useChatRuntimeStore.getState().keepModelsLoaded &&
!statusRef.current?.is_audio &&
(statusRef.current?.serving?.length ?? 0) > 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect chat replacement beside an existing speech model

When the user loads chat first and keeps a speech model beside it under fit/always, then changes Model memory to Off and picks another speech model, statusRef.current can still be the kept audio view (the setting unloads idle slots in a backend background task and this page gets no lifecycle refresh). This makes !statusRef.current?.is_audio false even though the ensuing Off-mode load replaces the still-primary chat model, so both the advance warning and the post-load “Keep both loaded” recovery action are omitted; determine displacement from the slot/serving identity or refresh status after the mode change instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing: this only omits an advisory toast line after a mid-session mode change; the load itself behaves correctly and the next status read corrects the view.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96f805631f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

});
if (options?.signal?.aborted)
throw options.signal.reason ?? new DOMException("Aborted", "AbortError");
await options?.beforeRequest?.();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle cancellation during the pre-request unload

When Keep multiple models loaded is on and the user leaves Audio while useAudioModelSlot's beforeRequest unload is pending, the deactivation effect aborts pending.controller while requestStarted is still false. This await is not abortable and has no post-hook cancellation rollback, so after it removes the old speech slot, onRequestStart runs and authFetch receives an already-aborted signal; the replacement /load never goes out. Fresh evidence beyond the earlier fixed preflight report is this new cancellation window inside the awaited hook itself; make cancellation during the hook restore/retain the previous slot or otherwise complete the replacement atomically.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing: it needs the user to leave Audio during the short unload of a model they asked to replace; leaving mid-load cancels the load by design, and loading it again restores the state.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

…and offer Keep both loaded to the owner only

[skip ci]
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddc76c558d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +275 to +276
const keepsChat = useChatRuntimeStore.getState().keepModelsLoaded;
const stopDecision = keepsChat

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish fit mode before skipping chat confirmation

When Model memory is fit, keepModelsLoaded is true even though alongside: true only preserves the primary when the new model actually fits; the backend's load_model_gated fallback (covered by test_the_replace_fallback_refuses_while_the_active_model_generates) replaces the primary and returns 409 if that chat is generating. This branch therefore skips confirmStopRunningChatsIfNeeded and sends force_cancel_active: false, so choosing a TTS model during a running chat succeeds when the pair fits but always fails when it does not, instead of offering the previous stop/force flow. Preserve the distinction between fit and guaranteed coexistence, or retry the replacement through confirmation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing: it needs a running chat plus a speech model that does not fit beside it; the server refuses with its active-generation 409 and nothing is lost, the same as Chat's own keep-others load.

# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
@danielhanchen
danielhanchen merged commit f969957 into unslothai:main Oct 19, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
… model (unslothai#14369)

Fixes unslothai#14320

## Summary

With Keep multiple models loaded set to When they fit or Always, a
speech model loaded from the Audio page already stays beside the chat
model (unslothai#14191). An API request does not. When `/v1/audio/speech` names a
speech model while a chat model is loaded:

- Always: the request is refused with `Loading this model would unload
the chat model ..., and Keep multiple models loaded is set to Always.`
- When they fit: the speech model replaces the chat model, and the next
chat request swaps them back.

The same happens in the other order, a chat request naming the chat
model while a speech model is loaded.

The automatic load behind API requests always loaded into the primary
seat. It never asked for a kept slot the way the Audio page and the chat
auto-load do with `alongside`.

## Changes

- Under When they fit or Always, when the requested model and the loaded
one are different kinds (speech vs text), the automatic load now goes
through `load_model_gated` with `alongside=True`. That is the same path
`POST /load` uses: the kept slot, the fit checks, unloading idle models
first under When they fit, and the refusal under Always when the new
model does not fit. The request is then served from the new slot.
- Off is unchanged. So is a request naming another model of the same
kind: a second chat model still replaces the chat model, and a second
speech model still replaces the speech model.
- `load_model_gated` and `_run_tracked_load_model_impl` take an optional
`impl_kwargs`, so the speech codec staging the switch prepares still
reaches the load.

## Testing

Kaggle T4x2, both Studios installed with `install.sh --local` from main
`4b8447f63a` (base on GPU0, base plus this change on GPU1). Chat model
`unsloth/Qwen3.5-2B-GGUF` Q4_K_M, speech model
`audio-cpp/audio.cpp-gguf/Kokoro-82M-GGUF` through the API. "Serving" is
what `/api/inference/status` reports.

| Mode | Scenario | main | this PR |
|---|---|---|---|
| When they fit | chat loaded, then `/v1/audio/speech` | 200, serving
only Kokoro | 200, serving Qwen and Kokoro |
| When they fit | then `/v1/chat/completions`, then speech again | 200 /
200, chat reloaded, then Kokoro reloaded | 200 / 200, no reload |
| When they fit | speech first, then chat | serving only Qwen | serving
Kokoro and Qwen |
| Always | chat loaded, then `/v1/audio/speech` | 409 (the error in the
issue) | 200, serving Qwen and Kokoro |
| Always | speech first, then chat | chat 409 | 200, serving Kokoro and
Qwen |
| Off | chat loaded, then `/v1/audio/speech` | speech model replaces
chat | unchanged |
| any | Audio page load with `alongside: true` | both kept | unchanged |

The clips are the same size on both sides (106844, 75644 and 72044
bytes).

Unit tests in `tests/test_openai_auto_switch.py`:

- A speech switch under When they fit and Always loads beside a chat
model.
- A chat switch loads beside a speech model.
- Off, or a second speech model, still replaces the primary.

The three beside cases fail on main. `test_openai_auto_switch.py`,
`test_multi_model_always.py` and `test_multi_model_serving.py` all pass
(965 passed). The 65 backend test files that touch the changed functions
pass too. The 5 failures under `-n 24` also pass serially on both main
and this branch, so they are parallel-run flakes.


## Before / after

Colab T4, both Studios built with `install.sh --local` (main `4b8447f63`
and this PR at `c74df642c`), Keep multiple models loaded set to When
they fit. One `/v1/chat/completions` request naming
`unsloth/Qwen3.5-2B-GGUF`, then one `/v1/audio/speech` request naming
`audio-cpp/audio.cpp-gguf/Kokoro-82M-GGUF`, then the loaded-models card
on the chat page.

![Loaded models card after an API chat request and then an API speech
request: main lists only Kokoro, this PR lists Qwen and
Kokoro](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14369/pr14369_loaded_models_before_after-61f42d4716cb.png)

The same run on the final head repeats the table above: under When they
fit and Always both models stay served in either order, Off still
replaces, and the Kokoro clips are the same size on both sides (121244
bytes).
danielhanchen pushed a commit to NilayYadav/unsloth that referenced this pull request Nov 6, 2026
…thai#16831)

With the "Unsloth model" read-aloud engine, Read aloud in chat can take
seconds longer than Generate on the Audio page for the same text and the
same loaded speech model. A user on Discord reported 10 to 20 s in chat
against about half a second on the Audio page.

## Cause

Before every utterance, `generateStudioTtsAudio` looks up the loaded
speech model with `GET /v1/models` (`resolveReadAloudModel`, added in
unslothai#14191) so it can name it in `/audio/generate`. `/v1/models` lists every
downloaded model, and the scan behind it is cached for only 30 s
(`_CATALOG_TTL_S`). A click more than 30 s after the last listing, which
is the usual case for reading a finished reply, waits for a full rescan
of the downloaded models. The Audio page never lists the catalog, so it
does not pay this cost. Auto read-aloud and the Settings › Voice preview
use the same function and wait the same way.

## Fix

Read aloud now lists models from `GET /api/inference/loaded-models`,
which unslothai#10728 added so agent startup would not wait on the same scan. Its
rows are the same `_openai_model_objects` entries that `/v1/models`
marks `loaded: true`, including `task` and `audio_workflows` for a
speech model kept beside the chat model, so the chosen model id does not
change.

There are no backend changes. The "Custom endpoint" engine and system
voices do not use this lookup and are unchanged. If the reporter was
using "Custom endpoint", this PR does not address their delay.

Not addressed: the same report says auto read-aloud does not speak a
scheduled task's reply when the chat is opened. `AutoReadAloud` only
speaks a reply that finishes while the chat is open, which is how it
treats every chat opened from history. Speaking unread scheduled results
on open would need a separate product decision.

## Verification

Live on `origin/main` (`16060aba73`) with a CPU-only Studio,
`gemma-4-E2B-it` Q4_K_M as the chat model and Kokoro-82M loaded beside
it. I sent the request sequence the adapter sends (the listing, then
`/audio/generate` naming the speech model it found), waiting 35 s before
each one. Listing time:

| Round | `/v1/models` (main) | `/api/inference/loaded-models` (this PR)
|
| --- | --- | --- |
| 1 | 3.25 s | 0.02 s |
| 2 | 13.16 s | 0.01 s |
| 3 | 3.78 s | 0.01 s |

Generation took about 9 s on both (Kokoro on the CPU). Both listings
returned the same loaded rows, and every response came from Kokoro.

- `read-aloud-studio-voice.test.ts` now serves the loaded-models
listing, and a new test checks that read aloud never requests
`/v1/models`. It fails on main.
`tts-custom-connections-disabled.test.ts` mocks the new path.
- 380 tests in the read-aloud, TTS and model-catalog files pass. Full
frontend suite: 14943 pass and 18 fail. 17 of those also fail with
main's versions of these files. The remaining one is a find-in-page
timing test that passes 3 out of 3 times when run alone.
- Typecheck passes. Biome and ESLint report the same findings on these
files as on main.
- I did not click Read aloud in a browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Allow TTS models to stay loaded in VRAM similar to STT models

2 participants