From d63399f4c96e954e310fc38edda2f5c20a6151d8 Mon Sep 17 00:00:00 2001 From: Bossiara13 <236771060+DmitryBykov-ISPO@users.noreply.github.com> Date: Fri, 15 May 2026 17:06:46 +0300 Subject: [PATCH] feat(gui): footer backend chips + Settings 'AI Backends' tab + i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surfaces the LLM/TTS hot-swap UX in the GUI so the user doesn't need env vars or voice commands. Tauri commands for this landed in b243e67; this commit wires them to Svelte. Footer (frontend/src/components/Footer.svelte) - Poll get_active_backends() every 5 s, show TTS / LLM / Profile chips. - Chips have border accents by kind (cyan = TTS, lime = LLM, orange = Profile). - Friendly title tooltips with full backend + model names. - Silent if jarvis-gui can't reach the command (e.g. cold start) — no UI flicker. Settings — new "AI Backends" tab (frontend/src/routes/settings/index.svelte) - Status banner showing active LLM (with model name) + TTS + Profile. - LLM selector: Auto / Groq / Ollama → calls set_llm_backend on change (hot-swap, persisted to DB). - TTS selector: Auto / SAPI / Piper / Silero → calls set_tts_backend (persisted, effective on next jarvis-app restart). - "Reset context" button → llm_reset_context Tauri command. - Error toast for swap failures (e.g. Groq selected but no GROQ_TOKEN). - Tips alert: how to install Ollama / Piper / voice commands. - Loads prefs via db_read('llm_backend' / 'tts_backend') on mount. i18n strings (ru/en/ua, .ftl files) - 14 new keys: settings-ai-backends, settings-ai-active, settings-ai-auto, settings-ai-applying, settings-ai-error, settings-ai-tips, settings-llm-backend{,-desc}, settings-tts-backend{,-desc}, settings-llm-context{,-desc}, settings-llm-reset, settings-profile. Build glue (crates/jarvis-gui/Cargo.toml) - jarvis-core dep now includes the `llm` feature so backends.rs can resolve `jarvis_core::llm::*` (was failing to compile after the global LLM module). .gitignore - tools/piper/*.dll, piper.exe, voices/, espeak-ng-data/ — locally installed binaries from tools/piper/install.ps1, not committed. Build: cargo build --release -p jarvis-gui green (4m, includes npm/Vite). Test path: rebuild + launch jarvis-gui, /settings → "AI Backends" tab. --- .gitignore | 12 ++ crates/jarvis-core/src/i18n/locales/en.ftl | 18 ++- crates/jarvis-core/src/i18n/locales/ru.ftl | 18 ++- crates/jarvis-gui/Cargo.toml | 2 +- frontend/src/components/Footer.svelte | 95 ++++++++++++ frontend/src/routes/settings/index.svelte | 172 ++++++++++++++++++++- 6 files changed, 313 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b707412..2fecd1b 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,15 @@ tree.txt # Tauri-generated platform schemas (regenerated on every build) crates/jarvis-gui/gen/schemas/*-schema.json + +# Piper TTS binaries (installed via tools/piper/install.ps1, not committed) +tools/piper/piper.exe +tools/piper/*.dll +tools/piper/espeak-ng-data/ +tools/piper/voices/ +tools/piper/libtashkeel_model.ort +tools/piper/pkgconfig/ + +# Silero model cache (downloaded by torch.hub on first synth) +tools/silero/.silero_cache/ +tools/silero/*.pt diff --git a/crates/jarvis-core/src/i18n/locales/en.ftl b/crates/jarvis-core/src/i18n/locales/en.ftl index 3860189..9282cb4 100644 --- a/crates/jarvis-core/src/i18n/locales/en.ftl +++ b/crates/jarvis-core/src/i18n/locales/en.ftl @@ -141,4 +141,20 @@ settings-gliner-models-hint = No GLiNER models found. # ETC search-error-not-running = Assistant is not running search-error-failed = Failed to execute command -settings-no-voices = No voices found \ No newline at end of file +settings-no-voices = No voices found + +# AI Backends tab +settings-ai-backends = AI Backends +settings-ai-active = Active backend +settings-ai-auto = Auto +settings-ai-applying = Applying... +settings-ai-error = Switch failed +settings-ai-tips = Tips +settings-llm-backend = LLM backend +settings-llm-backend-desc = Where to run LLM requests. Hot-swap, no restart needed. +settings-tts-backend = TTS backend +settings-tts-backend-desc = Takes effect on next jarvis-app launch. +settings-llm-context = Conversation context +settings-llm-context-desc = LLM remembers previous turns. Reset if answers get weird. +settings-llm-reset = Reset context +settings-profile = Profile \ No newline at end of file diff --git a/crates/jarvis-core/src/i18n/locales/ru.ftl b/crates/jarvis-core/src/i18n/locales/ru.ftl index f4ea952..12ab39d 100644 --- a/crates/jarvis-core/src/i18n/locales/ru.ftl +++ b/crates/jarvis-core/src/i18n/locales/ru.ftl @@ -141,4 +141,20 @@ settings-gliner-models-hint = Модели GLiNER не найдены. # ETC search-error-not-running = Ассистент не запущен search-error-failed = Не удалось выполнить команду -settings-no-voices = Голоса не найдены \ No newline at end of file +settings-no-voices = Голоса не найдены + +# AI Backends tab +settings-ai-backends = ИИ-движки +settings-ai-active = Активный движок +settings-ai-auto = Авто +settings-ai-applying = Применяю... +settings-ai-error = Ошибка переключения +settings-ai-tips = Подсказки +settings-llm-backend = LLM движок +settings-llm-backend-desc = Где исполнять LLM-запросы. Hot-swap, без рестарта. +settings-tts-backend = TTS движок +settings-tts-backend-desc = Применится при следующем запуске jarvis-app. +settings-llm-context = Контекст разговора +settings-llm-context-desc = LLM помнит предыдущие реплики. Сбросить, если ответы становятся странными. +settings-llm-reset = Сбросить контекст +settings-profile = Профиль \ No newline at end of file diff --git a/crates/jarvis-gui/Cargo.toml b/crates/jarvis-gui/Cargo.toml index 8273215..842c45a 100644 --- a/crates/jarvis-gui/Cargo.toml +++ b/crates/jarvis-gui/Cargo.toml @@ -7,7 +7,7 @@ repository.workspace = true edition.workspace = true [dependencies] -jarvis-core = { path = "../jarvis-core", default-features = false } +jarvis-core = { path = "../jarvis-core", default-features = false, features = ["llm"] } tauri = { version = "2", features = [] } # v1: "shell-open", "dialog-message", "path-all" tauri-plugin-shell = "2" tauri-plugin-dialog = "2" diff --git a/frontend/src/components/Footer.svelte b/frontend/src/components/Footer.svelte index 87f8ac9..4c53fb9 100644 --- a/frontend/src/components/Footer.svelte +++ b/frontend/src/components/Footer.svelte @@ -1,4 +1,7 @@