fix: Chat und Stimmen-Seite nennen den Grund für eine leere Stimmenliste; Version 0.1.15-rc10

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg6k5Hxh8GpVW7od4Di
This commit is contained in:
2026-11-20 19:37:42 +01:00
parent 2211c3f77d
commit dcd7971b96
9 changed files with 78 additions and 18 deletions

View File

@ -31,6 +31,11 @@ pub trait Engine: Send + Sync {
Vec::new()
}
/// Antwortet der Dienst hinter der Stimmenliste? Unterscheidet „keine Stimmen“ von „Dienst aus“.
async fn voices_reachable(&self) -> bool {
true
}
/// Wie die Engine gestartet wird (nur zur Anzeige, ohne Geheimnisse).
fn start_info(&self) -> StartInfo {
StartInfo::default()

View File

@ -191,6 +191,10 @@ impl Engine for StudioEngine {
}
}
async fn voices_reachable(&self) -> bool {
self.reachable(Duration::from_secs(3)).await
}
async fn voices(&self) -> Vec<crate::types::Voice> {
let get = |path: &'static str| {
let url = format!("{}{path}", self.base());
@ -292,6 +296,17 @@ impl Engine for StudioEngine {
#[cfg(test)]
mod tests {
#[tokio::test]
async fn studio_aus_ist_nicht_erreichbar_und_ohne_stimmen() {
// Port 9 (discard) ist lokal geschlossen: Die Liste ist leer und „nicht erreichbar“ wird gemeldet.
let engine = StudioEngine::new(StudioConfig {
base_url: "http://127.0.0.1:9".to_string(),
..StudioConfig::default()
});
assert!(!engine.voices_reachable().await);
assert!(engine.voices().await.is_empty());
}
use super::*;
use std::path::PathBuf;
use tokio::io::{AsyncReadExt, AsyncWriteExt};