feat(stt): make decode language a first-class config.toml key - #22
Merged
Conversation
[stt] language (env STT_WS_LANGUAGE > config.toml > "en") now feeds all three launch paths through the shared ConfigStore instead of a raw os.environ read in the websocket branch only. "auto" maps to None at the backend boundary (_resolve_stt_language) — whisper/mlx rejects the literal string. The local whisper/MLX branches honour it too (previously hardcoded "en"); Deepgram does not consume it. onoats init prompts for the language in the local STT branch and writes the key.
Review findings on the language-config feature: - whitespace-only [stt].language fell through as language="" — restore the strip-then-default guard the old inline code had (env values were already strip-guarded inside _env_or). - non-interactive init re-runs rebuilt the [stt] table without language, silently erasing a configured value (service/model/ws_socket carried, language did not). Carry it like the others; idempotent-rerun test now pins it. - switching to Deepgram in the wizard dropped the key — carry it forward so switching backends and back keeps the preference.
… alias Deep-review architecture finding: the env var now governs every STT backend, not just the websocket one, so the bare name matches the other cross-backend vars (STT_SERVICE / STT_MODEL). STT_WS_LANGUAGE stays as a lower-precedence alias for backward compatibility. Resolution: STT_LANGUAGE > STT_WS_LANGUAGE > [stt].language > "en".
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.
What
[stt] languageinconfig.tomlis now the source of truth for the STT decode language, resolved through the shared ConfigStore (envSTT_LANGUAGE(legacy aliasSTT_WS_LANGUAGE) >[stt].language>"en"), so every launch path — CLI, menu-bar app,onoats init— picks it up. Previously the websocket branch reados.environdirectly and the local whisper/MLX branches hardcoded"en".How
OnoatsConfig.stt_language: new property, same env-over-file-over-default precedence as the other[stt]keys; strip-then-default so a whitespace-only file value falls back toenrather than reaching a backend aslanguage="".runtime._resolve_stt_language(cfg): mapsauto(any case) toNoneat the backend boundary — whisper/mlx rejects a literal"auto"and usesNonefor built-in detection; nemotron maps client-Noneto its own auto language-ID. Resolved once so the websocket and local whisper branches cannot drift.update_session), whisper-MLX, whisper-CPU. Deepgram does not (not wired; documented).onoats initprompts for the language in the local-STT branch and writes the key. Non-interactive re-runs carry an existinglanguageforward (likeservice/model/ws_socket), and switching to Deepgram in the wizard preserves it for a later switch back.Review fixes (second commit)
In-session review found and fixed three issues:
[stt].languageresolved to""(dropped the old inlineor "en"guard) — restored, test-pinned.onoats initre-runs silently erased a configuredlanguagefrom the rebuilt[stt]table — now carried like the other keys, pinned by the idempotent-rerun test.Verification
uv run pytest); ruff format + check clean.en, toml value, env-over-toml, whitespace fallback,auto→None(case-insensitive),Settings(language=None)accepted by pinned pipecat, init writeslanguage = "auto", re-run preservation.rg 'language="en"|STT_WS_LANGUAGE' src/onoatsshows only the single resolution point in the config property.Known gap (deliberate): no
--stt-languageflag for non-interactiveonoats init— config.toml or env covers automation; add the flag only if a driver needs it.Full pre-merge battery complete: in-session review + Codex adversarial (converged, fixes in 5a44097), /update-docs (changelog synced in a53dd11), /security-review (no findings), /deep-review (env-var rename in 4723bbd; two Minor architecture notes triaged as wont-fix candidates).