Add MP3 speech output and Hermes Accept negotiation; stage without activation

This commit is contained in:
Mikei386 committed 2026-10-17 18:56:35 +02:00
1 parent f3630f63ba
commit 92b8214c87
6 files changed
+143 -7

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
# Athena speech MP3 — prepared, not activated
The user requested MP3 output for Hermes Live Talk, then explicitly asked not to
restart the Athena endpoint yet. No production restart or activation was made.
## Implementation
`POST /v1/audio/speech` accepts `response_format=mp3` and returns a complete
MP3 file with `Content-Type: audio/mpeg`. The generated WAV is encoded locally
using the existing FFmpeg/libmp3lame, 128 kbit/s and one encoder thread. Both
ordinary TTS and the voice-tool output path use the same final encoding step.
Hermes WebUI's installed read-aloud request omits `response_format` and sends
`Accept: audio/mpeg`. Athena now selects MP3 for that header. An explicit
`response_format` overrides Accept. Otherwise the existing WAV default remains;
PCM streaming and its response headers are unchanged. Encoder errors have
dedicated API codes, without exposing FFmpeg stderr.
## Prepared artifact and activation boundary
- Stage: `/opt/athena-deck-dev/tts-mp3-20261017`.
- Prepared image: `athena-deck-standalone:tts-mp3-20261017`.
- Image ID: `sha256:4c0bf988aa766615893fe32610dea2e9156a0de5cd24eb5a4f9b74d458aa785e`.
- Base remains the currently active
`athena-deck-standalone:ssd-bars-fixed-20261015`.
- Recipe: `deploy/Dockerfile.tts-mp3`, app-only replacement of `endpoint.py`.
- Active container remains `athena-deck-dev`, healthy on the old image.
- Its start timestamp and restart count were compared before/after and match.
Activation is deferred until the user gives a new go. Before activation, check
for active requests and intervening image/code updates. Preserve the installation
manifest, mounts, settings and runtime selection through the regular deployment
helper. Do not overwrite newer application changes with this prepared delta.
## Validation
Seven focused tests passed in a disposable container using the prepared image,
with no network, no GPUs and no production state mounts (1 CPU, 512 MiB RAM):
- MP3 through explicit format and Hermes-style Accept, correct MIME/length.
- Explicit WAV overrides MPEG Accept; MPEG with q=0 keeps WAV default.
- Real HTTP MP3 conversion of one second of synthetic WAV followed by successful
FFmpeg decoding to PCM. Encoding took approximately 0.14 seconds in this test;
this is not a model synthesis or end-to-end voice latency measurement.
- Existing WAV publication/voice/language behavior and PCM streaming/error cases.
- Missing encoder, conversion timeout and safe error handling.
The broader local endpoint suite was also attempted and is not fully green:
chat/vision/queue tests failed independently of the audio path. The unchanged
HEAD version of `test_chat_accepts_json_larger_than_one_mib` was run separately
and reproduces the same 503. No claim that the entire suite passes is made.
The initially incomplete new test mock was corrected; all seven focused tests
then passed in the prepared image.
No real voice generation was requested from production during this preparation,
and Hermes browser Live Talk has not been verified against an activated build.
HTTPS on the WebUI page and the separate TTS provider URL are distinct; this
change does not modify either URL or bypass Hermes URL validation.
## Native installation and restore
The implementation is ordinary Deck Python code. A fresh native Debian runtime
needs `apt-get install ffmpeg` with the distribution's libmp3lame encoder;
the current Deck image already contains it. Restore the code from Git plus the
normal encrypted state/provider data. No new model weights, credentials or
private files are required. Full native install/restore was not tested here.