fix(tts): leerer Audio-Strom des Studios wird zu 502 (#1109), nicht installierte Studio-Modelle werden ausgeblendet und abgelehnt (#1110), Version 0.1.10-rc5
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg5YdSXUmKzjHCaEWQp
This commit is contained in:
@ -181,6 +181,13 @@ async fn fake_backend() -> u16 {
|
||||
// Sprachausgabe: liefert ein winziges „Audio“ und gibt die gesehenen Felder im Kopf zurück.
|
||||
async fn speech(body: Bytes) -> Response {
|
||||
let req: Value = serde_json::from_slice(&body).unwrap();
|
||||
// „LEER“: wie ein Studio, das mit 200 beginnt und dann ohne Ton abbricht (→ #1109).
|
||||
if req["input"] == "LEER" {
|
||||
return Response::builder()
|
||||
.header(CONTENT_TYPE, "audio/pcm")
|
||||
.body(Body::empty())
|
||||
.unwrap();
|
||||
}
|
||||
Response::builder()
|
||||
.header(CONTENT_TYPE, "audio/wav")
|
||||
.body(Body::from(format!(
|
||||
@ -557,6 +564,36 @@ async fn sprachausgabe_reicht_audio_durch_und_verlangt_key_und_modell() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn sprachausgabe_ohne_ton_wird_zu_502_statt_leerem_200() {
|
||||
let gw = gateway(0, false).await;
|
||||
let leer = json!({"model": "bonsai", "input": "LEER", "voice": "Vivian"}).to_string();
|
||||
let resp = gw
|
||||
.client
|
||||
.post(format!("{}/v1/audio/speech", gw.base))
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.bearer_auth(&gw.key)
|
||||
.body(leer)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(resp.status(), 502);
|
||||
let body: Value = serde_json::from_str(&resp.text().await.unwrap()).unwrap();
|
||||
assert_eq!(body["error"]["code"], "upstream_no_audio");
|
||||
// Eine Anfrage mit Ton geht danach weiterhin durch (die Instanz bleibt benutzbar).
|
||||
let gut = json!({"model": "bonsai", "input": "Hallo", "voice": "Vivian"}).to_string();
|
||||
let resp = gw
|
||||
.client
|
||||
.post(format!("{}/v1/audio/speech", gw.base))
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.bearer_auth(&gw.key)
|
||||
.body(gut)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(resp.status(), 200);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn streaming_wird_stueckweise_durchgereicht_und_nicht_gepuffert() {
|
||||
let gw = gateway(0, false).await;
|
||||
|
||||
Reference in New Issue
Block a user