feat(gateway): support inbound media and file attachments#655
Closed
iamninihuang wants to merge 2 commits intoopenabdev:mainfrom
Closed
feat(gateway): support inbound media and file attachments#655iamninihuang wants to merge 2 commits intoopenabdev:mainfrom
iamninihuang wants to merge 2 commits intoopenabdev:mainfrom
Conversation
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
Collaborator
|
Close in favor of #652 |
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 problem does this solve?
Currently, the Custom Gateway adapter only supports receiving plain text (
GwContent.text). If a user sends an image, file, or voice message via a custom gateway (like LINE, Telegram, etc.), the bot ignores it because the schema lacks attachment support.How does it solve it?
This PR introduces comprehensive media support for the Gateway adapter, mirroring the logic already present in Discord and Slack adapters:
GwContentwith an optionalattachments: Vec<GwAttachment>array.media::download_and_encode_image.media::download_and_read_text_file.stt.enabledis true, it transcribes audio attachments usingmedia::download_and_transcribe. To support this,stt_configis now propagated to the Gateway params.Is this the best approach?
Yes. It leverages the existing, battle-tested functions in
src/media.rsthat the Discord and Slack adapters rely on, ensuring consistent memory bounds (e.g., resizing images to 1200px max, 10MB limits, 1MB text caps) and consistentContentBlockstructures across all platforms.