Merge feature/modellseite: Modellarten und Stimmenfreigabe

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg5PTXgibMTZUHzfLYM
This commit is contained in:
2026-11-18 20:35:59 +01:00
11 changed files with 429 additions and 15 deletions

View File

@ -49,6 +49,13 @@ impl Engine for FixedEngine {
capabilities: Capabilities::default(),
}
}
async fn voices(&self) -> Vec<nexus_adapter::Voice> {
vec![nexus_adapter::Voice {
id: "Ryan".into(),
name: "Ryan".into(),
saved: true,
}]
}
async fn discover(&self) -> Result<Vec<DiscoveredArtifact>, AdapterError> {
// Ein schon registriertes Modell (bonsai) und ein neues.
Ok(["bonsai", "neu-gefunden"]
@ -2576,6 +2583,37 @@ async fn playground_liest_vor_nur_mit_sprachmodell_und_sitzung() {
async move { req.send().await.unwrap() }
};
let gut = json!({"model": "sprecher", "input": "Hallo", "voice": "Ryan"});
assert_eq!(
sprechen(cookie.clone(), Some(csrf.clone()), gut.clone())
.await
.status(),
403
);
let (_, _, stimmen) = ui_get(&gw, "/ui/chat/stimmen?modell=sprecher", Some(&cookie)).await;
assert!(
!stimmen.contains("Ryan"),
"Ohne Freigabe nicht im Playground"
);
let probe = gw
.client
.post(format!("{}/ui/modelle/probe", gw.base))
.header("origin", &gw.base)
.header("cookie", &cookie)
.header("x-csrf-token", &csrf)
.header(CONTENT_TYPE, "application/json")
.body(json!({"model":"sprecher", "voice":"Ryan"}).to_string())
.send()
.await
.unwrap();
assert_eq!(probe.status(), 200, "Probehören braucht keine Freigabe");
assert_eq!(
probe.text().await.unwrap(),
"RIFF|sprecher|Guten Tag, ich bin eine Stimme von Nexus.|pcm"
);
gw.state
.store()
.set_voice_approved("Ryan", true, TEST_ADMIN, true)
.unwrap();
let resp = sprechen(cookie.clone(), Some(csrf.clone()), gut.clone()).await;
assert_eq!(resp.status(), 200);
assert_eq!(resp.headers()[CONTENT_TYPE], "audio/pcm");