feat(tts): multi-voice switcher for EN & RU, Irina default voice, punctuation pause normalization and speed calibration

This commit is contained in:
2026-10-07 12:07:01 +03:00
parent 7893b353aa
commit 31e105b2c2
11 changed files with 486 additions and 61 deletions
+11 -1
View File
@@ -2242,7 +2242,11 @@ def test_piper_tts_endpoints_and_caching():
data = resp.json()
assert "available" in data
assert data["engine"] == "piper-vits"
assert "en_US-lessac" in data["voices"]
voice_ids = [v["id"] for v in data["voices"]]
assert "en_US-lessac" in voice_ids
assert "ru_RU-irina" in voice_ids
assert "en_US-ryan" in voice_ids
assert "en_GB-alan" in voice_ids
# 2. Test TTS synthesis of English word
tts_resp = client.get("/api/tts?text=Astronomy&lang=en&speed=1.0", headers=auth_headers)
@@ -2250,6 +2254,12 @@ def test_piper_tts_endpoints_and_caching():
assert "audio/wav" in tts_resp.headers.get("content-type", "")
assert len(tts_resp.content) > 1000
# 2b. Test TTS synthesis of Russian phrase with dash and Irina voice
ru_resp = client.get("/api/tts?text=Важный%20проект%20—%20он%20работает&lang=ru&voice=ru_RU-irina", headers=auth_headers)
assert ru_resp.status_code == 200
assert "audio/wav" in ru_resp.headers.get("content-type", "")
assert len(ru_resp.content) > 1000
# 3. Test repeat request returns cached audio
cached_resp = client.get("/api/tts?text=Astronomy&lang=en&speed=1.0", headers=auth_headers)
assert cached_resp.status_code == 200