fix(gateway): use OGG for Telegram auto TTS

This commit is contained in:
Gilad Bauman
2026-06-07 18:05:58 -07:00
committed by Teknium
parent cb83149dc6
commit ae82eed2b1
2 changed files with 104 additions and 3 deletions
+4 -3
View File
@@ -12422,11 +12422,12 @@ class GatewayRunner:
if not tts_text:
return
# Use .mp3 extension so edge-tts conversion to opus works correctly.
# The TTS tool may convert to .ogg — use file_path from result.
# Telegram's adapter only sends native voice bubbles for OGG/Opus.
# Other platforms keep the existing MP3 default.
audio_ext = "ogg" if event.source.platform == Platform.TELEGRAM else "mp3"
audio_path = os.path.join(
tempfile.gettempdir(), "hermes_voice",
f"tts_reply_{_uuid.uuid4().hex[:12]}.mp3",
f"tts_reply_{_uuid.uuid4().hex[:12]}.{audio_ext}",
)
os.makedirs(os.path.dirname(audio_path), exist_ok=True)