diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-18 23:18:37 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-18 23:18:37 +0200 |
| commit | b252c39517b9fce181d1a0fe4761404c7d981397 (patch) | |
| tree | 564cf01aed601f1974e0de8801d4452215ec05f5 /src/lang.rs | |
| parent | fir auto completion and send file in the response body upon grajcuj file (diff) | |
| download | senator-sperma-b252c39517b9fce181d1a0fe4761404c7d981397.tar.gz senator-sperma-b252c39517b9fce181d1a0fe4761404c7d981397.zip | |
feat: local TTS via piper subprocess with Google fallback
- New src/tts.rs: centralize TTS in synthesize(config, http_client, text)
Piper subprocess primary, Google Translate fallback on error/missing
- TTS_MODEL_PATH/TTS_VOICE env config (defaults to pl_PL-bass-high)
- Fix Unknown interaction errors: spawn play_tts_in_channel in background
so voice-state TTS no longer blocks the shard event loop (3s Discord limit)
- Best-effort confirmation replies in /tts to prevent error cascade
- Custom on_error handler: graceful interaction-expired error handling
- Comprehensive tracing logging (engine, model, duration, stderr)
Diffstat (limited to 'src/lang.rs')
| -rw-r--r-- | src/lang.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lang.rs b/src/lang.rs index 05e82fd..aad0413 100644 --- a/src/lang.rs +++ b/src/lang.rs | |||
| @@ -114,6 +114,13 @@ pub fn fmt_voice_join_failed(e: &dyn std::fmt::Display) -> String { | |||
| 114 | pub const L_TTS_SAVED: &str = "TTS zapisany"; | 114 | pub const L_TTS_SAVED: &str = "TTS zapisany"; |
| 115 | pub const L_TTS_PLAYING: &str = "Grom TTS na kanale głosowym"; | 115 | pub const L_TTS_PLAYING: &str = "Grom TTS na kanale głosowym"; |
| 116 | 116 | ||
| 117 | pub fn fmt_tts_piper_launch(e: &str) -> String { | ||
| 118 | format!("Piper sie nie uruchomił w czas: {e}") | ||
| 119 | } | ||
| 120 | pub fn fmt_tts_piper_failed(e: &str) -> String { | ||
| 121 | format!("Piper TTS sie nie powiodło: {e}") | ||
| 122 | } | ||
| 123 | |||
| 117 | // ── Trigger command ─────────────────────────────────────────────────── | 124 | // ── Trigger command ─────────────────────────────────────────────────── |
| 118 | 125 | ||
| 119 | pub const L_TRIGGER_UPDATED: &str = "Trigger zaktualizowany"; | 126 | pub const L_TRIGGER_UPDATED: &str = "Trigger zaktualizowany"; |
