fix(gateway): add missing send_voice() override to WhatsApp adapter - #9522
Closed
luyao618 wants to merge 1 commit into
Closed
fix(gateway): add missing send_voice() override to WhatsApp adapter#9522luyao618 wants to merge 1 commit into
luyao618 wants to merge 1 commit into
Conversation
WhatsApp was the only platform adapter without a send_voice() override. Voice/audio messages fell back to the base class implementation which sent them as plain text paths instead of native media attachments. The new method routes through the existing _send_media_to_bridge() with media_type="audio", consistent with send_image, send_video, and send_document. Fixes NousResearch#9236
Contributor
|
Thanks for the contribution, @luyao618! Closing this as a duplicate of #6305 (by @duan78), which targets the same fix/feature. We're consolidating on that PR for review. If you want to help push it over the line, please jump in there — or if you think your approach is better for a specific reason that isn't covered in the other PR, let us know and we can reopen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds the missing
send_voice()method to the WhatsApp platform adapter. WhatsApp was the only adapter without this override — voice/audio messages fell back to the base class implementation which sent them as plain text paths (e.g.🔊 Audio: /path/to/file.mp3) instead of native media attachments.Related Issue
Fixes #9236
Type of Change
Changes Made
Added
send_voice()togateway/platforms/whatsapp.pythat routes through the existing_send_media_to_bridge()withmedia_type="audio", consistent withsend_image,send_video, andsend_document.The WhatsApp bridge (
bridge.js) already handles the"audio"media type — it reads the file and sendssock.sendMessage({ audio: buffer, mimetype: "audio/mpeg" }). No bridge-side changes needed.How to Test
🔊 Audio: /tmp/hermes_voice/tts_reply_abc123.mp3Run the test suite:
Tests verify:
send_voicemethod exists and is not the base class fallback ✅_send_media_to_bridgewith type"audio"✅Full suite:
Checklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping