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

@ -12,6 +12,9 @@ pub enum IpcEvent {
// Speech recognized
SpeechRecognized { text: String },
// LLM produced a reply for a free-form question
LlmReply { text: String },
// Command was executed
CommandExecuted { id: String, success: bool },