Skip to content

feat(example): per-step model selection for the Voice Loop (STT / LLM / TTS) - #412

Merged
DenisovAV merged 3 commits into
mainfrom
feat/voice-loop-model-selection
Aug 11, 2026
Merged

feat(example): per-step model selection for the Voice Loop (STT / LLM / TTS)#412
DenisovAV merged 3 commits into
mainfrom
feat/voice-loop-model-selection

Conversation

@DenisovAV

Copy link
Copy Markdown
Owner

What

Follow-up to #411 (which standardized model selection for TTS). The Voice Loop still hardcoded its three models (Moonshine Tiny / Gemma 3 1B IT / Matcha-TTS) with no way to change them. This lets the user pick the model for each step via the standard per-modality list screens — same pattern as everywhere else, no in-screen dropdowns.

  • SttModelsScreen / TtsModelsScreen / ModelSelectionScreen — gain an optional onSelected callback: in "pick" mode, tapping an entry returns it and pops instead of navigating into the working screen.
  • voice_setup_screen.dart (new) — VoiceSetupScreen: three tappable rows (STT / LLM / TTS), each opening the matching list in selection mode, plus a Start Voice Loop button. Defaults reproduce the previous trio, so behaviour is unchanged until a step is swapped.
  • voice_screen.dartVoiceScreen now takes required sttModel / llmModel / ttsModel (drops the hardcoded statics).
  • model_selection_screen.dart — new hideBuiltIn flag: the LLM picker hides OS built-in models (Gemini Nano / Apple Foundation Models), which can't install via the plain installModel().fromNetwork() path the voice loop uses.
  • home_screen.dart — the Voice Loop card routes to VoiceSetupScreen.

Example-only; no package or public-API changes.

… / TTS)

The Voice Loop hardcoded its three models (Moonshine Tiny / Gemma 3 1B IT / Matcha-TTS). Let the user pick each step via the standard per-modality list screens — same pattern as everywhere else, no in-screen dropdowns.

- SttModelsScreen / TtsModelsScreen / ModelSelectionScreen gain an optional onSelected callback: in pick mode, tapping an entry returns it and pops instead of navigating into the working screen.
- new VoiceSetupScreen: three tappable rows (STT/LLM/TTS) each opening the matching list in selection mode, plus a Start button. Defaults reproduce the previous trio, so behaviour is unchanged until a step is swapped.
- VoiceScreen now takes required sttModel/llmModel/ttsModel (drops the hardcoded statics).
- home_screen: Voice Loop routes to VoiceSetupScreen.
- drive-by: wrap a pre-existing multi-line if (!mounted) return; in braces to clear its lint.

Example-only; no package/public-API changes.
… hide built-in LLM

Addresses review feedback on the Voice Loop commit:
- resolve unresolvable [VoiceSetupScreen] dartdoc links (that class isn't imported by these files — a back-import would cycle) by rendering it as inline code, matching the files' own convention for non-imported screens.
- clarify VoiceSetupScreen's class doc: the LLM step uses ModelSelectionScreen and is ungated; only STT/TTS gate on a shipped profile.
- hide the OS built-in models (Gemini Nano / Apple Foundation Models) from the LLM picker via a new ModelSelectionScreen.hideBuiltIn flag — they can't install via the plain installModel().fromNetwork() path the voice loop uses, so offering them was a dead end.
…close resources on failed init, widget tests

Addresses the full-review findings on #412:
- ModelSelectionScreen: replace hideBuiltIn bool with a modelFilter predicate; the Voice Loop LLM picker passes (m) => !m.isBuiltIn && !m.localModel, so it no longer offers localModel asset entries (url is an assets/ path) the fromNetwork install can't handle.
- VoiceScreen._initializeVoiceSession: close the already-activated STT/TTS/LLM sessions on a failed init or early unmount (they leaked because dispose only reclaims the state fields).
- Add device-free widget tests (voice_setup_test.dart): default trio + modelFilter excludes localModel entries.
- Doc: note pick-a-model mode in the STT/TTS models-screen class docs.
@DenisovAV
DenisovAV merged commit 2bd9da8 into main Aug 11, 2026
5 checks passed
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