From 6edeeb6006ebad106b2287a791ffe46ffd8f849f Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:25:11 +0200 Subject: [PATCH] Default speech API to legacy German language setting --- docs/SPEECH_NOTATION.md | 2 +- endpoint.py | 2 +- test_endpoint.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/SPEECH_NOTATION.md b/docs/SPEECH_NOTATION.md index 907b182..89666c9 100644 --- a/docs/SPEECH_NOTATION.md +++ b/docs/SPEECH_NOTATION.md @@ -11,7 +11,7 @@ German examples: - `05–06 Uhr` → `5 bis 6 Uhr` - `04.–05.09.` → `4. bis 5. September` -The preparation also handles percentages, IPv4 addresses, postal codes, aspect-ratio cues, selected abbreviations and Markdown. German expansions apply only to German language settings. Hyphenated words retain their punctuation for Qwen prosody. Chunking preserves ordinal dates such as `5. Oktober`. +The preparation also handles percentages, IPv4 addresses, postal codes, aspect-ratio cues, selected abbreviations and Markdown. German expansions apply only to German language settings. The speech endpoint defaults to German, matching the old gateway and Deck's direct TTS controls; explicitly supplied languages remain honored. Hyphenated words retain their punctuation for Qwen prosody. Chunking preserves ordinal dates such as `5. Oktober`. Validation: 78 speech/endpoint unit tests and two NumPy PCM streaming tests passed on Athena in isolated containers. The upload regression test verifies that valid PCM WAV input retains every frame, including the beginning. diff --git a/endpoint.py b/endpoint.py index f63b154..6d5ec01 100644 --- a/endpoint.py +++ b/endpoint.py @@ -366,7 +366,7 @@ class APIHandler(BaseHTTPRequestHandler): if ep.scheduler.gpu_mode=='voice':raise APIError('Ein aktives Stimmwerkzeug-Profil wählen.',404,'model_not_found') profile=ep.find_profile(data.get('model'),'audio');backend=ep.tts profile_seconds=time.monotonic()-started - try:job=backend.start(profile['id'],data.get('input'),speaker=data.get('voice','Ryan'),language=data.get('language','Auto'),speed=data.get('speed'),wait=True,**({'streaming':True} if streaming else {})) + try:job=backend.start(profile['id'],data.get('input'),speaker=data.get('voice','Ryan'),language=data.get('language','German'),speed=data.get('speed'),wait=True,**({'streaming':True} if streaming else {})) except InferenceError as exc:raise APIError(str(exc),503,'tts_resources_unavailable') from None except ValueError as exc:raise APIError(str(exc)) from None logging.getLogger('athena.tts').warning('TTS request admitted job=%s wait_seconds=%.3f profile_seconds=%.3f',job['id'],time.monotonic()-started,profile_seconds) diff --git a/test_endpoint.py b/test_endpoint.py index 14fd5a9..3ff5305 100644 --- a/test_endpoint.py +++ b/test_endpoint.py @@ -281,6 +281,9 @@ class EndpointTests(unittest.TestCase): c=http.client.HTTPConnection('127.0.0.1',self.port,timeout=5);c.request('POST','/v1/audio/speech',json.dumps({'model':'audio','input':'hello','voice':'Ryan','response_format':'wav'}),{'Content-Type':'application/json','Authorization':'Bearer '+'A'*32});r=c.getresponse() self.assertEqual(r.status,200);self.assertEqual(r.getheader('Content-Type'),'audio/wav');self.assertEqual(r.read(),b'RIFF-test-WAVE');c.close() self.assertEqual(self.ep.tts.start.call_args.kwargs['speaker'],'Ryan') + self.assertEqual(self.ep.tts.start.call_args.kwargs['language'],'German') + self.assertEqual(self.request('/v1/audio/speech',{'model':'audio','input':'hello','language':'English'})[0],200) + self.assertEqual(self.ep.tts.start.call_args.kwargs['language'],'English') def test_tts_resource_errors_are_service_errors_not_invalid_input(self): self.rows[-1].update(runnable=True,blockers=[]);self.enable('audio') self.ep.tts=Mock();self.ep.tts.start.side_effect=InferenceError('Sprachausgabe wartet auf belegte Ressourcen.')