Skip to content

Studio: voice conversation mode, latency benchmark and audio reply text (consolidates #10373, #10374, #11074) - #12265

Closed
donaldfilimon wants to merge 62 commits into
unslothai:mainfrom
donaldfilimon:main
Closed

donaldfilimon wants to merge 62 commits into
unslothai:mainfrom
donaldfilimon:main

Conversation

@donaldfilimon

Copy link
Copy Markdown
Contributor

Summary

This consolidates three closed PRs into one: #10373, #10374 and #11074. All three reconstruct #6527 (voice mode by @BardiaKoopah and @LeoBorcherding) on current main. They closed on 2026-09-29 because the fork they came from was deleted. No review closed them. The feature and the credit still belong to the original authors.

Each branch is merged in with --no-ff, so its history stays intact and you can review each part on its own or revert it cleanly:

The only file more than one part touches is studio/backend/routes/inference.py (parts A and D), and it auto-merged cleanly. If you would rather take these as separate PRs, I'm happy to split them again.

Test plan

  • Backend: the voice, audio and training-coexistence suites (test_voice_slot_*, test_audio_reply_text, test_openai_audio_speech_route, test_training_vram_coexistence, test_mcp_training_start_guard): 139 passed
  • Benchmark: studio/benchmarks/voice/test_voice_bench.py: 36 passed, 34 subtests passed
  • Frontend: npm run typecheck is clean. npm test ran 9386 tests: 9383 passed and 3 timed out under full-suite parallel load (reasoning-source-render, tauri-backend-transport-failure). All 18 tests in those two files pass when run alone.
  • ruff check passes on every changed Python file. Biome reports style findings in the new files, and it is non-blocking in CI.
  • I did not run the full studio/backend/tests suite on this merge. The upstream CI run is the evidence for it.
  • Not tested here: a real microphone and browser. The code typechecks and passes the unit suites, but nothing in this PR claims the loop speaks until someone runs it on hardware.

🤖 Generated with Claude Code

donaldfilimon and others added 30 commits September 4, 2026 03:22
…enchmark

Split out of PR unslothai#6527 so the voice conversation path can be reviewed on its own.

Orpheus synthesizes the input utterances (cached), fed through STT -> LLM -> TTS
against a running Studio backend. Records per-stage wall clock and a
length-normalized rate (STT/TTS real-time factor, LLM tok/s) so a longer
utterance isn't counted as slower, with first-audio latency as the headline. It
also gates on accuracy -- STT word error rate, topical coverage, LLM determinism
-- so a speedup that hurts the answers is caught rather than celebrated.
Reasoning-aware: times the first SPOKEN token, and --think measures what a chat
model's chain of thought costs first audio. Writes JSON reports and diffs against
a baseline. Tokens, reports and fixtures are gitignored.

Independent of the voice-slot branch: STT and TTS go through
/v1/audio/transcriptions and /v1/audio/speech, which main already serves, and the
/api/inference/voice/status probe degrades to empty when that route isn't there.

Co-authored-by: LeoBorcherding <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TSaSnTn9AUf4wPbCaTTykW
Rebuilds PR unslothai#6527 on today's main. The branch was cut from 2026-06-23 and main
has since landed its own audio stack, so roughly two thirds of the original diff
is now duplicate work and is dropped rather than merged:

- routes/audio.py in full. /audio/speech, /audio/transcriptions and the STT
  sidecar family already exist on the inference router, dual-mounted under /v1,
  monitored and body-capped. Streaming is added there as /audio/speech/stream
  instead of on a second router, so it inherits all of that.
- audio_type on LoRAInfo, detect_audio_type_from_local, and the scan_loras
  threading: superseded by audio_type/audio_type_known and
  detect_audio_type_checked.
- the Listen modal for trained TTS LoRAs: the Audio page lists and plays them.
- the Whisper dictation adapter, STT engine toggle, STT model selector and mic
  picker: superseded by StudioDictationAdapter, StudioModelDictationAdapter and
  the voice-settings store.
- Qwen3-TTS: an independent optional backend with an on-demand pip install,
  deferred to its own PR.

What is left is the part main does not have: a speech-to-speech conversation
loop, and a second llama-server "voice slot" so a TTS model can stay resident
beside the chat LLM. _generate_tts_wav prefers that slot when it is loaded, and
AudioSpeechRequest.voice is now honoured for named-speaker codecs instead of
being accepted and ignored.

The frontend half lands as its own module, features/chat/voice/: the loop and its
composer control in voice-engine.tsx, the orb's priority order as a pure tested
function in orb-state.ts, and the cross-remount registry in voice-loop-bridge.ts.
thread.tsx keeps the two mount points and the plus-menu item, +53 lines against
main rather than +751, so this path can be read, reviewed and reverted on its own.

Review findings addressed:
- /voice/load now runs _guard_chat_load_against_training, so enabling a voice
  during training is refused rather than placing another model (P1). It runs it
  through _offline_guarded, the way /load does.
- the shared audio codec is reference-counted, so unloading one slot no longer
  frees the codec the other is still decoding through. A manager nobody claimed
  is still freed, so a load cancelled between constructing it and claiming it
  does not leak it.
- each llama-server slot writes its own pidfile and the reaper sweeps them all;
  previously the second slot overwrote the first's record. The slot key is read
  off the instance rather than passed in, so _record_server_pid keeps the exact
  signature it has always had.
  Restoring that signature is also what keeps this branch from touching a single
  upstream test: an earlier draft widened it and broke the neutralising stubs in
  the shared llama_cpp placement fixture, which 46 test files reach through.
- voice mode is gated on the streaming speech-recognition engine, not on TTS
  alone, so it cannot be entered where no transcript can ever be produced.
- the silence timer no longer auto-sends while TTS is audible, which was posting
  echo of the model's own voice as the user's next message.
- switching the chat model to a speech-LLM now clears and unloads the separate
  voice slot instead of only greying out the picker.
- audio priming plays a real silent source, so the first clip is not refused by
  autoplay policy.
- browser-speech completion is tied to its request id, so a cancelled utterance
  cannot end the new one early.
- when the backend produces no audio for a whole reply, it falls back to browser
  speech rather than going silent.

Found while porting: the streaming path bypassed neutralize_tts_prompt_text
(unslothai#7066) and chose a decode device without consulting holds_no_vram; both fixed.
The TTS player read the store's voiceSlotLoaded through a local shadow that
meant "a voice is selected", so the first synth of a turn could POST into a slot
that had not finished loading. The voice download path sized itself off
size_bytes where every other download path uses download_size_bytes ||
size_bytes, which under-reports a sharded GGUF. The PCM player assumed 24 kHz
instead of reading the X-Sample-Rate header the stream route already sends.

Not verified end to end: this needs a GPU, a llama-server, TTS weights and a
browser, none of which were available, so no claim is made that the loop
speaks. What did run, on macOS against the CI commands: ruff 0.15.12, compileall,
the four custom linters, tsc -b plus the test project, the strict i18n parity
check, the frontend unit suite (6,858 pass), vite build, the bundle budget, and
the backend pytest suite in both its parallel and serial passes. Every backend
failure left on this machine reproduces identically on origin/main.

Co-authored-by: Bardia Koopah <[email protected]>
Co-authored-by: LeoBorcherding <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TSaSnTn9AUf4wPbCaTTykW
…ion engines

Voice mode was offered only when Settings -> Voice was set to the browser's Web
Speech engine, and hidden otherwise. Under Tauri the default is "model", so the
desktop app never showed Voice at all.

The reason was real: the loop's turn-taking watches the transcript grow, and a
batch engine ("model" or "custom") returns one transcript when the session ends,
so nothing grows and the 1.5s silence timer would close the mic and find an empty
composer every time. The loop now owns end-of-utterance for those engines
instead, from the microphone meter both adapters already publish through
startDictationLevelMeter. No change to any adapter.

- 900ms of quiet after real speech ends the turn: above the model adapter's own
  280ms segment cut, below the streaming engine's 1.5s. Quiet before the user has
  said anything is just the room, so an idle mic listens indefinitely.
- the same meter drives voiceHearing for BOTH engines, and closing the mic sets
  voiceTranscribing. Those two store fields had readers and orb states but no
  writer anywhere; this supplies them.
- submitTranscript, which was written for this path and unreferenced, is what
  sends the result, so a batch turn takes exactly the same send, coalesce and
  re-arm path as a streaming one.

Barge-in is deliberately NOT wired for the batch engines, and the mic is not
armed during playback for them either. Their session records continuously and
transcribes the whole recording on stop, so a mic open while the model speaks
would post the model's own words back as the user's next message, and a
transcript that only arrives at the end cannot be echo-checked after the fact.
The streaming engine survives this because its barge-in requires the transcript
to grow and its silence timer drops anything heard while audio is audible.
Doing it properly needs acoustic echo cancellation on the capture stream. Until
then the batch loop is listen, transcribe, generate, speak, listen again.

Unexercised: this needs a microphone and a browser. It typechecks, builds, and
the unit suite is green, and that is the whole of the claim.

Co-authored-by: Bardia Koopah <[email protected]>
Co-authored-by: LeoBorcherding <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TSaSnTn9AUf4wPbCaTTykW
…erminism, or --repeats < 1

summarize() silently dropped any turn whose stage errored (its metric was None),
so a run with a broken stage could total *lower* than its baseline and still exit
0. It now reports `complete` plus the (pass, turn) gaps; print_report lists them,
diff_baseline refuses to compare an incomplete run (or an incomplete baseline),
and main exits 1. A determinism check that ran and found the two seeded replies
different (or could not run at all) also exits 1 instead of only printing.
`--repeats` is validated as a positive integer at parse time; 0 or a negative
value used to reach summarize() and raise IndexError after the warmup and
determinism requests had already been spent. Exit codes are documented.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…o their utterance

speak() now sends the benchmark --seed as AudioSpeechRequest.seed on every
/v1/audio/speech call (fixtures, warmup, reply synthesis). The README claimed a
fixed TTS seed while the request carried none; it now says where the seed is
honoured on main (the transformers TTS path) and where it is not (a GGUF voice,
an external connection).

The fixture cache was keyed on the turn id alone, so editing a turn's text or
pointing --conversation at another script with the same ids kept feeding the old
turn_N.wav to STT. A turn_N.json sidecar records the utterance and whether the
wav was synthesized or supplied: a synthesized fixture whose text changed is
re-synthesized; a hand-supplied recording is adopted on first use and never
overwritten, raising FixtureMismatch instead so the turn fails visibly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…unk streams in; run determinism last

first_audio_latency summed stt + llm_ttft + tts_first, but speak() is only called
once the LLM stream has finished, and a clause-first streaming TTS could not
start on a single token either: the tokens between the first one and the end of
the opening clause are real waiting the formula dropped. chat_stream now records
(cumulative chars, seconds) per content delta, first_chunk_span() computes how
many streamed characters the first synthesizable chunk plus its closing boundary
occupy (a "." followed by "5" is a decimal, not a sentence end), and the new
llm_first_chunk_s is the arrival time of that span. The headline is now
stt_s + llm_first_chunk_s + tts_first_s; llm_ttft_s stays reported, and the
README states that turn_wall_s is the pipeline as implemented while
first_audio_latency is the streaming projection.

The determinism check ran before pass 1, so --no-warmup alone still measured an
LLM warmed by two full generations. It now runs after the measured passes (it
uses its own message list, so the result is unaffected), and all input fixtures
are materialized in a prepare step before any timed turn instead of being
synthesized mid-turn on a first run. The README documents the order and what a
genuinely cold pass needs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…xternal TTS connection

On origin/main Studio serves one resident model: _generate_tts_wav is reload-only
and returns 400 unless the resident model is a TTS model, while
/v1/chat/completions against a resident TTS model returns speech instead of
text. The harness needs a chat model and a voice at once, which only the voice
slot in the conversation-mode backend (PR unslothai#10373) provides; the README presented
that as a plain prerequisite ("Speak-with picker") without naming the PR, and on
main every speak() call would have 400'd after the chat stage. (Codex's
mechanism was auto-switch; that setting defaults off, but the outcome is the
same: the speech route never switches the resident model.)

resolve_tts_route() now decides before anything runs: a resident TTS model, or no
loaded voice slot and no external connection, exits 2 with the remedy named. New
--tts-provider-id/--tts-model/--tts-voice route every /v1/audio/speech call to a
saved external TTS connection via the [x-unsloth] provider_id field, which the
speech route proxies without touching the resident model, so the benchmark runs
on main alone (with the remote round trip in its TTS numbers). The README names
PR unslothai#10373 as the prerequisite for the local-TTS path, attributes the
leading-silence trim and GGUF TTS seed to that PR rather than to main, and
documents the audio-gallery side effect: the local speech route persists every
clip with no opt-out (9 clips per default run, 25 for --repeats 3), pruned at
UNSLOTH_AUDIO_GALLERY_MAX_CLIPS/MAX_BYTES; a non-persisting option is a backend
follow-up outside this benchmark-only PR.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…rk's pure parts

Covers the pieces the review fixes touched: first_chunk_span/first_chunk_arrival
and chat_stream's first-chunk timing over a synthetic SSE stream, speak() sending
the seed and provider fields, summarize() completeness and the baseline-diff
refusal on an incomplete run, --repeats validation, resolve_tts_route on main
(no route), a resident TTS model, a loaded voice slot, and an external
connection, and the fixture sidecar (cache hit, re-synthesis on text change,
supplied recordings adopted and never overwritten, corrupt sidecar). Runs with
unittest or pytest; FIXTURES/DOWNLOADS are redirected to a temp dir so nothing
touches ~/Downloads.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…te the recorded findings' formula

The per-turn table gained a `chunk` column, so its rules now match the 84-char
header. The measured findings in the README were recorded under the earlier
stt_s + llm_ttft_s + tts_first_s definition and say so, since llm_first_chunk_s
is larger than llm_ttft_s by construction.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… review-added code

scripts/run_ruff_format.py (ruff format + enforce_kwargs_spacing.py) would
rewrap the _REQUIRED_METRICS tuple, the resolve_tts_route call, and three
over-long lines in the new tests; apply exactly those. The pre-existing kwarg-
spacing drift that plain `ruff format --check` reports on this directory (and
repo-wide) is the house style and is left alone.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e event loop

Review follow-ups on the voice slot (PR unslothai#10373):

- Training coordination now sees the voice slot. summarize_resident_chat()
  reports it under a new "voice" key and counts it toward "any"/"loading",
  and free_chat_models_for_training() unloads it in its own isolated block
  (voice:<name>), with the same CPU-only exemption as the chat slot. Without
  this a training start could unload the chat model and launch beside a
  second llama-server it never knew about. Covered by six new cases in
  test_training_vram_coexistence.py; _patch_backends grows a voice= stub.
- /voice/load resolves ModelConfig.from_identifier() via asyncio.to_thread
  under _hf_offline_if_unreachable_for, exactly as /load does, instead of
  scanning the HF cache on the event loop.
- /voice/unload and both /voice/load error-path teardowns run unload_model
  through asyncio.to_thread, as /unload does.
- /audio/speech/stream refuses IQ1/IQ2/Q2 Orpheus quants with a 400 before
  the monitor row opens: the spoken-name trim needs the whole clip, and the
  client already falls back to the blocking route on a non-OK response.
- The stream's read timeout stays flat, now documented and expressed via
  _GGUF_AUDIO_READ_TIMEOUT: httpx applies it per socket read, so on a
  token-by-token stream it bounds a stall between tokens, not the whole clip.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…voice loop

Review follow-ups on the conversation loop (PR unslothai#10373):

- A PCM stream that scheduled nothing (network failure, or a 200 that closed
  before its first chunk) now resolves as unplayed, so the caller falls back
  to the blob path and then the browser voice instead of advancing the loop
  in silence. A superseded request still reads as played, so a barge-in
  never triggers a fallback.
- speak() ends the turn (onPlaybackEnd) when normalization strips the whole
  reply, so an emoji-only answer no longer leaves voice mode with a dead mic.
- Browser-speech onend/onerror ignore events from a request that is no
  longer current, so a cancelled utterance's late error cannot cancel the
  replacement reply's queue.
- The coalesce timer re-arms while the barged-in run is still settling
  (bounded, ~10s) and only starts a run behind a trailing user bubble, so the
  appended bubbles get their reply once cancelRun() completes.
- A spoken utterance clears only the active thread's prompt queue via the
  new resetPromptQueuesForThread; resetPromptQueues is module-private again.
- useVoiceAvailable gates on listening alone: the picker always offers a
  local GGUF voice and the browser voice ends the turn cleanly without
  speechSynthesis, so the old TTS half hid the menu where the local voice
  was the only way to speak.
- Speech-LLM detection reads the model record's audioType first and falls
  back to the name pattern, so a renamed fine-tune still clears and unloads
  the voice slot. It lives in a dependency-free voice/speech-llm.ts with the
  codec sets moved to voice/tts-audio-types.ts (re-exported unchanged from
  use-tts-player), and has a node:test suite.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…quest

A --conversation with an empty turns list crashed determinism_check at
turns[0] after the passes, and under --no-determinism summarized zero
turns as complete: true with null totals and exit 0. load_conversation
now refuses a conversation with no turns, a turn without an integer id
or a non-empty text, or a repeated id (the fixture cache is keyed on the
id, so twins would share one recording); main exits 2 before contacting
Studio.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…model work

Only the fixed reports/ directory was created, so an --out under a
directory that did not exist yet raised FileNotFoundError after every
pass had run. prepare_report_path now resolves the report path right
after argument parsing, creates its parent (and reports/, where
latest.json goes), and rejects an --out that names a directory; main
exits 2 before contacting Studio.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…-loopback Studio

get_token minted (or reused) a key for the local auth database whatever
--base-url / UNSLOTH_BASE_URL pointed at, then sent that reusable local
secret to the remote host as a bearer. A non-loopback base URL now
requires --token or UNSLOTH_BENCH_TOKEN (a credential issued by that
server); otherwise main exits 2 before importing mint_token. Loopback
means 127.0.0.0/8, ::1, or "localhost"; an unparseable or host-less URL
counts as remote.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…sidecar hash

Replacing a synthesized turn_N.wav with a real recording, as the README
invites, left the sidecar saying source: "synthesized", so a later text
edit re-synthesized over the recording instead of raising
FixtureMismatch. The sidecar now records the sha256 of the bytes it
describes; a wav whose hash no longer matches is adopted as "supplied"
(pinned to the current text, like a sidecar-less drop-in) and is never
overwritten. A sidecar from before hashes existed is backfilled on the
next read; it cannot see an earlier replacement, and the README says to
delete it in that case.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… voice n_ctx

Second review round on the voice slot (PR unslothai#10373):

- /audio/speech/stream joins _INFERENCE_SUFFIXES. The tuple is an endswith
  test and the route ends in /stream, so the /audio/speech entry never covered
  it: with the stream as the only inference in flight, an API-key training
  start saw other_inference_request_count() == 0, unloaded the voice backend
  and cut the live PCM clip off instead of returning 409. Now that the route
  is tracked, its generator's swallowed-error arm also flags the response
  failed (mark_current_response_failed), since it ends the stream cleanly at
  200 and the middleware would otherwise read a failed clip as a completion
  that claims a preview-owned chat slot.
- _VoiceLoadRequest.n_ctx takes the same MAX_REQUESTABLE_CONTEXT ceiling as
  LoadRequest.max_seq_length. The handler models the load as a chat
  LoadRequest for the training-coexistence guard, so an oversized value used to
  pass validation and then fail inside the handler as a 500, after the HF
  resolve, instead of a 422 up front.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…pened

Two defects found uncommitted in the working tree.

The voice model selector expanded GGUF entries with `onDevice`, which
honors the global "Show all quantizations" setting (off by default) and
lists only quants already on disk. On a fresh install the uncached default
voice therefore expanded to "No GGUF variants found" and its first-use
download could never start. Every row downloads a missing quant on pick,
so the browse listing is the correct one here.

VoiceEngine called endStream unconditionally at run end, including for a
run that began before the user switched voice mode on — where no TTS
session was ever opened. Track whether the run-start branch actually
opened one and flush only then.

Verified with `npm run typecheck` in studio/frontend (exit 0). This is a
third-party upstream clone with no local gate of record; upstream CI
remains the real gate for the Python side.

Co-Authored-By: Claude Opus 5 <[email protected]>
…e the loop's half-duplex gaps

Running this branch in the desktop app, the loop cut its own reply about a word
in and left empty transcripts flickering through the composer. The causes were
all on the listen/speak boundary, so this brings back the unslothai#6527 frontend that
owned it and fixes what the port exposed.

Restored from unslothai#6527:

- StudioWhisperDictationAdapter, which owns a turn end to end: capture, energy
  VAD with two-threshold hysteresis, transcribe, commit, re-arm. Rebased onto
  the current stack, so it resolves models through the STT registry
  (loadSttModel / requestSttDownload / transcribeAudioBlob) instead of letting
  the backend pick, which was 400ing on an undownloaded 'small'.
- The streaming TTS player, whose replacement clipped audio between sentences.
- The STT model and microphone pickers, repointed at the current model-selector
  components and the renamed store fields.
- The sentence chunker, now in its own dependency-free module so it can be
  tested without pulling in React and auth. It keeps abbreviations, decimals,
  initials and closing quotes attached, and stripForSpeech no longer collapses
  the newlines the splitter needs, which had made a multi-paragraph reply one
  synth request. Nine tests cover it.

Fixed on top:

- resumeListen had no half-duplex guard. On a batch STT engine the mic re-armed
  during playback, heard the model through the speakers, and tripped the
  adapter's own barge-in ~220ms in. It now defers the re-arm (rather than
  dropping it, which would dead-end the loop) until generation and playback are
  done, and energy barge-in is ignored on batch engines, matching the rule
  already written into armDuringTts.
- An empty transcript went down the barge-in path and called stop() before the
  emptiness was checked, so a silent turn cut audio that was still playing.
- Streaming synthesis was strictly serial: each sentence waited for the previous
  one to finish *playing*, and voiceParallelN never reached that path at all, so
  a configured voice slot sat with an idle llama-server slot. Sentences now
  generate up to voiceParallelN ahead, gated so they still schedule in order,
  onto one shared playhead -- the jitter buffer is paid once per reply instead of
  at every sentence boundary. N=1 collapses to the old serial behaviour.

The blob fallback is gated on the same chain: a Q2 Orpheus quant is refused
streaming by the backend and 400s in milliseconds, so an ungated window would
start every sentence's fallback at once and stamp them over each other on the
shared audio element.

Not verified: the audible result on hardware is the reporter's to judge; there
is no mic or speaker in CI. Typecheck is clean and the frontend suite passes.
Resolves the five conflicts against upstream main. The one Daniel asked about
is `_pid_slot` against main's new spawn locking (unslothai#10592):

- `llama_cpp.py`: main's `_spawn_lock` / `_teardown_lock` and the locked spawn
  blocks are taken whole, with the PR's slot-aware `_record_own_server_pid`
  substituted for `_record_server_pid` at both call sites. Main never changed
  the pid-helper definitions, only moved the call sites under the lock, so the
  two changes compose rather than compete. The chat slot keeps the identical
  single-argument path and the identical pidfile path (`_slot_pidfile_path("")`
  returns the base path), so startup reaping is unchanged when no voice slot has
  ever been recorded.
- `audio_codecs.py`: main's `_load_snac(model_repo_path)` signature, plus the
  PR's `has_codec`.
- `routes/inference.py`: main's `requested_model` budgeting and `require_speech`
  switch are taken whole and wrapped in the PR's voice-slot guard, and the guard
  now also requires that no model was named. A caller that names a model keeps
  main's path exactly: the voice slot owns speech only for the resident-model
  form, which is what voice conversation mode sends.
- `check-bundle-budget.ts`: main's re-measured budget, not the PR's older raise.
- `thread.tsx`: main's dock inset and dictate-button sizing, with the PR's
  `voiceOrbActive` z-index and voice-mode wrapper.

Co-Authored-By: Claude Opus 5 <[email protected]>
…dent-model form

The main merge takes main's named-model switch in _generate_tts_wav and wraps
it in the voice-slot guard, and the guard now also requires that no model was
named. Nothing pinned that seam: the existing pre-switch-budget test runs with
no voice slot loaded, so it could not tell a bypass that ignores a named model
from one that honours it. The conversation loop sends {input, voice} with no
model, so it takes the voice slot; a named /v1/audio/speech request reaches the
switch even with the voice slot loaded.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
claude and others added 16 commits September 23, 2026 23:10
…ast setting

Main's contrast-slider test now rejects fixed-alpha washes in chrome. The
voice and STT model selectors drew their separators with bg-black/[0.08]
and bg-white/[0.08]; they now use the gain-aware spelling the chat settings
sheet already uses for the same separator, which resolves to the same colour
at the default contrast.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HdL6vCyq1LbkqH3WpH9mMz
…live across chats

Browser speech is gone from the conversation loop. "Browser voice" and
"Browser" listen are removed from the header pickers, the loop always uses
a local transcription model and the voice slot, and the speechSynthesis
fallback in the player is gone: a sentence the slot cannot synthesize now
toasts once instead of switching to a system voice mid-reply. The Dictate
button's own browser engine in Settings is untouched; the no-speech hook
this PR had added to the web-speech adapter is reverted since nothing in
voice mode reaches it any more.

Opening voice with no chat model used to arm the mic and sit on
"Listening" with nothing to answer. The orb now has a "waiting" state
("Select a model"), the mic stays shut, and it arms itself when a model
loads. Starting a new chat no longer turns voice off: the thread-switch
reset cuts the old turn and re-arms on the new thread, the same way the
loaded model survives.

The microphone picker leaves the STT dropdown; the loop reads the device
chosen in Settings > Voice, adopts a pin made in the old picker on first
load, and falls back to the default input when a pinned mic is unplugged.
Parallel synthesis moves behind a gear in the "Speak with" header and
gets a row in Settings > Voice. Exported voices show their name instead
of a full filesystem path (loraOptionLabel). Opening voice seeds the last
used or default voice, since null no longer means "browser".

Header order is listen, speak, speaker name. The idle orb uses theme
tokens (--voice-orb-idle-*) in light and dark rather than a fixed grey;
the overlay fades in 200ms and stops animating while minimized. The two
STT sidecars spawn with the same hidden-window kwargs as llama-server so
whisper-server and the MTMD server no longer open console windows under
the desktop shell.
@danielhanchen

Copy link
Copy Markdown
Member

Thanks for pulling these together; since the reply-text change in chat-adapter.ts is independent and small, could you split it back out, with the benchmark on its own, so the voice slot work in llama_cpp.py can be reviewed separately?

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

fixed the closed branches and uploaded as the following prs, closing this one as duplicate:

#12384
#12385
#12386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants