fix: enable Opus voice output for Feishu and Lark platforms - #51819
fix: enable Opus voice output for Feishu and Lark platforms#51819leowangzi wants to merge 1 commit into
Conversation
Edge TTS generates MP3, which requires ffmpeg conversion to Opus to be sent as a native voice message on Feishu/Lark. Previously only Telegram received this conversion; this change adds feishu and lark so TTS audio is delivered as playable voice bubbles instead of file attachments.
Related: competing fix cluster for #45557. The earliest want_opus PRs are now closed (#45555, #45637, #32258); still-open alternatives are #45712 (Feishu-only |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for narrowing the conversion gate to the Feishu/Lark delivery path. The current-main premise is valid: tools/tts_tool.py:2202 still restricts want_opus to Telegram, while the Feishu plugin routes .ogg/.opus as native audio at plugins/platforms/feishu/adapter.py:5025-5026.
Problems
- Please add a regression test for
HERMES_SESSION_PLATFORM="feishu".tests/tools/test_tts_opus_routing.py:47-70currently exercises only Telegram, so this new routing branch is unprotected. larkis not a current session-platform value: the Feishu/Lark adapter is constructed asPlatform.FEISHU(plugins/platforms/feishu/adapter.py:1442) and the gateway exports that value (gateway/run.py:15000-15002). Thefeishucase covers Lark-domain deployments.- This remains conversion-dependent:
_convert_to_opus()returnsNonewhen ffmpeg is absent or fails (tools/tts_tool.py:899-933), after which non-Opus Feishu audio falls back to file routing (plugins/platforms/feishu/adapter.py:5034-5037).
Suggested changes
- Add the Feishu routing regression and limit the condition to the reachable platform identity.
- State the ffmpeg-success condition, or separately validate a fallback before promising native bubbles without it.
Automated hermes-sweeper review.
| @@ -2177,7 +2177,7 @@ def text_to_speech_tool( | |||
| # and needs ffmpeg for conversion. | |||
There was a problem hiding this comment.
Please add a Feishu regression in tests/tools/test_tts_opus_routing.py. The current test covers only Telegram; exercise this new branch with HERMES_SESSION_PLATFORM="feishu" and assert .ogg conversion plus the voice directive.
| @@ -2177,7 +2177,7 @@ def text_to_speech_tool( | |||
| # and needs ffmpeg for conversion. | |||
There was a problem hiding this comment.
lark is not emitted by the current adapter: Feishu/Lark constructs Platform.FEISHU, and the gateway exports its value as feishu. The feishu case already covers Lark-domain deployments; retaining an unreachable alias makes the routing contract misleading.
|
The root cause here (gateway auto-TTS choosing MP3 vs Ogg/Opus via the cleared (Landed via #73508, merge |
Problem
TTS voice messages on Feishu/Lark are sent as file attachments instead of playable voice bubbles.
Root Cause
In
tools/tts_tool.py,want_opus(which triggers ffmpeg conversion from MP3 to Opus and marks the output asvoice_compatible) only checked forplatform == "telegram". Feishu and Lark were excluded.Meanwhile, the Feishu adapter only uploads
.ogg/.opusfiles with the native "audio" message type (_FEISHU_OPUS_UPLOAD_EXTENSIONS = {".ogg", ".opus"}). MP3 files fall through to generic file attachment delivery.Fix
One-line change: extend the
want_opuscondition to includefeishuandlark:This triggers:
voice_compatible = True→[[audio_as_voice]]marker prependedTesting
Tested on Feishu with Edge TTS: voice messages now arrive as playable audio bubbles instead of file attachments.