Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8682,11 +8682,16 @@ async def _send_voice_reply(self, event: MessageEvent, text: str) -> None:
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.
# Use .ogg extension for Telegram (native voice bubble format)
# so providers like ElevenLabs/OpenAI output opus natively.
# For other platforms, .mp3 is fine. The TTS tool's opus
# conversion fallback handles Edge TTS and other mp3-only providers.
from gateway.session_context import get_session_env
_platform = get_session_env("HERMES_SESSION_PLATFORM", "").lower()
_tts_ext = "ogg" if _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]}.{_tts_ext}",
)
os.makedirs(os.path.dirname(audio_path), exist_ok=True)

Expand Down