feat(example): per-step model selection for the Voice Loop (STT / LLM / TTS) - #412
Merged
Conversation
… / 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.
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
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 optionalonSelectedcallback: 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.dart—VoiceScreennow takesrequired sttModel / llmModel / ttsModel(drops the hardcoded statics).model_selection_screen.dart— newhideBuiltInflag: the LLM picker hides OS built-in models (Gemini Nano / Apple Foundation Models), which can't install via the plaininstallModel().fromNetwork()path the voice loop uses.home_screen.dart— the Voice Loop card routes toVoiceSetupScreen.Example-only; no package or public-API changes.