feat(app): wire LlmClient into voice loop with trigger-prefix fallback

new module crates/jarvis-app/src/llm_fallback.rs holds an optional
LlmClient + ConversationHistory built once at startup. if GROQ_TOKEN is
unset the module logs a warning and stays disabled — voice commands keep
working as before.

both the wake-word voice path (recognize_command in app.rs) and the
gui-side text command path (process_text_command) now check whether the
recognized phrase starts with one of the configured trigger phrases
(ru: 'скажи' / 'ответь' / 'произнеси'). when it does, the remainder of
the phrase is sent to Groq and the reply is published as a new
IpcEvent::LlmReply { text } so the gui can speak it.

on api error the trailing user turn is popped from history, the russian
fallback line is sent over ipc and a 'error' voice cue plays. the loop
itself never panics.
This commit is contained in:
Bossiara13 2026-04-23 02:16:02 +03:00
parent 176f405310
commit e5aaa7e064
4 changed files with 144 additions and 3 deletions

View file

@ -18,6 +18,7 @@ mod log;
// include app
mod app;
mod llm_fallback;
// include tray
// @TODO. macOS currently not supported for tray functionality.
@ -55,6 +56,9 @@ fn main() -> Result<(), String> {
// init i18n
i18n::init(&settings.lock().language);
// init LLM fallback (no-op if GROQ_TOKEN missing)
llm_fallback::init();
// init recorder
if recorder::init().is_err() {
app::close(1);