feat: Modellarten und persönliche Stimmenfreigabe ergänzen
This commit is contained in:
@ -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"]
|
||||
@ -2464,6 +2471,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");
|
||||
|
||||
Reference in New Issue
Block a user