Skip to content

feat(voice): server-STT vocabulary bias + a device preference for server transcription - #697

Merged
thedancingdeveloper merged 1 commit into
mainfrom
feat/server-stt-vocabulary
Sep 11, 2026
Merged

thedancingdeveloper merged 1 commit into
mainfrom
feat/server-stt-vocabulary

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Contributor

What

Third and final fix behind "the app struggles to understand me". The phone picks its on-device recognizer, which mishears every domain word — and it's the transcriber that can't be taught. The server transcriber (Whisper) can be handed the vocabulary as a bias prompt, but the phone never uses it.

Changes

  • Engine: POST /api/assistant/stt accepts an optional prompt text field, forwarded to /audio/transcriptions as the backend's bias prompt (trimmed, bounded to 2 KiB via clamp_stt_prompt). A backend that ignores it is no worse off; no prompt transcribes exactly as before.
  • Client: sttVocabularyPrompt(slugs) builds the bias from the project slugs the client already knows plus a few fixed domain terms (shell, session, terminal, …); the server-STT path sends it alongside the audio.
  • Device preference: setPreferServerStt — a Settings checkbox shown only when the deployment offers server STT — makes the client select the server backend ahead of any on-device one, so a phone whose recognizer keeps mangling names can switch to the server + vocabulary. Effect on next launch.

Verified

Engine fmt + clippy -D warnings + assistant_speech:: tests (prompt trim/empty, bound). Web tsc + full vitest (113 files), incl. new sttPref tests (pref round-trip, prompt from slugs, empty-slug handling). Docs updated (ENGINE.md STT field; USER_GUIDE toggle).

PR 3 of 3 (after #695 dictation vocabulary, #696 task + agent templates).

🤖 Generated with Claude Code

https://claude.ai/code/session_01YG9Nsxqc6CREb56Uisnmmy

…ry, and let a device prefer it

The third fix behind "the app struggles to understand me". Server-side
transcription (Whisper) can be told which words to expect; the on-device
recognizer that a phone picks by default cannot, and it is the one turning
"komodo" into "Kardashian".

- Engine: `POST /api/assistant/stt` accepts an optional `prompt` text field
  and forwards it to `/audio/transcriptions` as the backend's bias prompt,
  trimmed and bounded to 2 KiB. A backend that ignores it is no worse off; a
  client that sends none transcribes exactly as before.
- Client: `sttVocabularyPrompt` builds that bias from the project slugs the
  client already knows plus a few fixed domain terms; the server-STT path
  sends it with the audio.
- A device whose recognizer keeps mishearing the vocabulary can now choose
  server transcription: `setPreferServerStt` (Settings checkbox, shown only
  when the deployment offers server STT) makes the client select the server
  backend ahead of any on-device one. It takes effect on the next launch.

Engine `clamp_stt_prompt` (+ tests: trim/empty, bound). Web `sttPref`
module (+ tests: pref round-trip, prompt built from slugs, project line
omitted when empty). Docs: the STT `prompt` field in ENGINE.md, the toggle
in USER_GUIDE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YG9Nsxqc6CREb56Uisnmmy
@thedancingdeveloper
thedancingdeveloper merged commit 37ed476 into main Sep 11, 2026
15 checks passed
@thedancingdeveloper
thedancingdeveloper deleted the feat/server-stt-vocabulary branch September 11, 2026 02:50
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.

1 participant