fix(tts): pocket-tts refuză text cu diacritice RO în loc să-l pronunțe greșit

Kyutai pocket-tts nu suportă română (vezi eval anterior). Codul rula
oricum sinteza pe orice text primit; acum _synthesize_pockettts
respinge diacriticele RO înainte de request, fără fallback silențios
pe altă voce.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 17:30:12 +00:00
parent a043e2f177
commit 00ac971044
3 changed files with 34 additions and 0 deletions

View File

@@ -128,6 +128,24 @@ class TestPockettsFallback:
assert result["ok"] is False
assert "400" in result["error"]
@patch("httpx.post")
def test_romanian_diacritics_rejected_without_calling_server(self, mock_post):
result = _synthesize_pockettts("Salut, cum îți este ziua?", {})
assert result["ok"] is False
assert "engleză" in result["error"]
mock_post.assert_not_called()
@patch("tools.tts._load_voice_catalog")
@patch("httpx.post")
def test_romanian_text_does_not_fall_back_to_supertonic(self, mock_post, mock_catalog):
mock_catalog.return_value = {"Marius 1": {"engine": "pockettts"}}
result = synthesize("Bună dimineața!", voice="Marius 1")
mock_post.assert_not_called()
assert result["ok"] is False
assert result["engine_used"] == "pockettts"
class TestSupertonicLangNaRetry:
@patch("tools.tts._load_voice_catalog")