fix: GUI max-width on wrapper + visible TTS swap result + warning cleanup
GUI MAX-WIDTH (was still stretched)
Root cause v2: my earlier rule applied max-width to #header and main
INDIVIDUALLY, but they live inside <Container fluid id="wrapper"> from
svelteui which goes full viewport width. Both children inherited that
full width from the flex layout. Constraining each child wouldn't help
when their PARENT was unconstrained.
Fix: max-width:1280px !important on #wrapper itself, with margin:0 auto.
Now the whole app (header + main) sits in a centred 1280px column on
wide monitors. !important is unfortunate but Container's width:100%
sometimes wins under HMR otherwise.
VISIBLE TTS SWAP RESULT (was failing silently)
User saved 'Piper' in dropdown → green 'Saved!' banner → active engine
chip still showed 'sapi'. Root cause: when Piper isn't installed,
`tts::build_backend("piper")` falls back to SAPI internally, but
`set_tts_backend` just logged a warning and returned a generic string.
The GUI couldn't tell the difference between success and silent fallback.
Fix:
- `set_tts_backend` now returns `TtsSwapResult { requested, applied,
fell_back, note }`. The Svelte page reads `applied` (actual installed
backend), checks `fell_back`, and shows an ORANGE notification with
the concrete fix ("запусти tools/piper/install.ps1 чтобы скачать
бинарь") instead of a green 'saved' lie.
- Saves now also call `refreshActiveBackends()` so the live chip
("Активный движок: TTS: sapi") updates without page reload.
- Green notification when swap succeeded normally.
WARNING CLEANUP
- jarvis-app/main.rs: removed unreachable `_ => {}` arm (all IpcAction
variants are explicit now).
- jarvis-app/tray.rs: moved `info!("Tray initialized.")` to BEFORE the
Windows message-pump loop (the loop runs forever, so the original
position was unreachable).
- jarvis-gui/main.rs: dropped unused #[macro_use] on simple_log.
- jarvis-gui/events.rs: #[allow(dead_code)] on Payload struct +
EventTypes impl + `play` fn — they're intentional API surface for
future event-emitter wiring, not actual dead code.
- Plus a `cargo fix` pass for misc unused imports.
Down from 12 warnings to 1 (npm-build-completion notice — informational).
Tests: 140 rust + 115 python (was 104, +11 for new wave59_handlers).
Release builds of jarvis-app + jarvis-gui both green.
This commit is contained in:
parent
944cfcc891
commit
965441d4db
12 changed files with 110 additions and 37 deletions
|
|
@ -138,12 +138,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
interface TtsSwapResult {
|
||||
requested: string
|
||||
applied: string
|
||||
fell_back: boolean
|
||||
note: string | null
|
||||
}
|
||||
|
||||
let ttsSwapInfo: TtsSwapResult | null = null
|
||||
|
||||
async function applyTtsBackend(target: string) {
|
||||
backendSwapError = ""
|
||||
ttsSwapInfo = null
|
||||
try {
|
||||
// 1. GUI Tauri command — persists to DB + hot-swaps GUI's TTS.
|
||||
await invoke<string>("set_tts_backend", { name: target })
|
||||
// Returns the actual installed backend (may differ from
|
||||
// requested if Piper/Silero unavailable → fell back to SAPI).
|
||||
const res = await invoke<TtsSwapResult>("set_tts_backend", { name: target })
|
||||
ttsSwapInfo = res
|
||||
// 2. Tell the running daemon (separate process) to switch too.
|
||||
switchDaemonTts(target || "auto")
|
||||
// 3. Refresh the "Активный движок" chip — without this, the user
|
||||
// saves Piper, sees "saved!", but the active label stays SAPI
|
||||
// because we never re-read the live engine.
|
||||
await refreshActiveBackends()
|
||||
} catch (err) {
|
||||
backendSwapError = String(err)
|
||||
}
|
||||
|
|
@ -453,9 +471,31 @@
|
|||
>
|
||||
{backendSwapError}
|
||||
</Notification>
|
||||
<Space h="md" />
|
||||
{/if}
|
||||
|
||||
<Space h="md" />
|
||||
{#if ttsSwapInfo && ttsSwapInfo.fell_back}
|
||||
<Notification
|
||||
title="TTS откатился на {ttsSwapInfo.applied.toUpperCase()}"
|
||||
color="orange"
|
||||
withCloseButton={true}
|
||||
on:close={() => { ttsSwapInfo = null }}
|
||||
>
|
||||
Запросил <strong>{ttsSwapInfo.requested}</strong> — недоступен.
|
||||
{#if ttsSwapInfo.note}<br/>{ttsSwapInfo.note}{/if}
|
||||
</Notification>
|
||||
<Space h="md" />
|
||||
{:else if ttsSwapInfo && !ttsSwapInfo.fell_back}
|
||||
<Notification
|
||||
title="TTS переключён на {ttsSwapInfo.applied.toUpperCase()}"
|
||||
color="teal"
|
||||
withCloseButton={true}
|
||||
on:close={() => { ttsSwapInfo = null }}
|
||||
>
|
||||
Применено сразу — без перезапуска.
|
||||
</Notification>
|
||||
<Space h="md" />
|
||||
{/if}
|
||||
|
||||
<InputWrapper label={t('settings-llm-context') || 'Контекст разговора'}>
|
||||
<Text size="sm" color="gray">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue