fix(telegram): route image documents (.png/.jpg/.webp/.gif) through vision pipeline#24815
Closed
kiranvk-2011 wants to merge 1 commit into
Closed
fix(telegram): route image documents (.png/.jpg/.webp/.gif) through vision pipeline#24815kiranvk-2011 wants to merge 1 commit into
kiranvk-2011 wants to merge 1 commit into
Conversation
…ision pipeline When users send images as documents (Telegram file picker), they were rejected with "Unsupported document type" because SUPPORTED_DOCUMENT_TYPES only includes text/office formats. Add SUPPORTED_IMAGE_DOCUMENT_TYPES to base.py and handle them in telegram.py before the document check. - Add SUPPORTED_IMAGE_DOCUMENT_TYPES constant to base.py - Add MIME reverse-lookup for image types in telegram.py - Route image documents through cache_image_from_bytes + vision pipeline - Handle media groups for image documents Closes: NousResearch#20128, NousResearch#18620
Collaborator
Contributor
This was referenced May 19, 2026
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.
Summary
When users send images as documents (via Telegram file picker instead of photo button), they were rejected with
"Unsupported document type"becauseSUPPORTED_DOCUMENT_TYPESonly includes text/office formats.This PR adds
SUPPORTED_IMAGE_DOCUMENT_TYPESto handle.png,.jpg,.jpeg,.webp, and.giffiles sent as documents, routing them through the image cache and vision pipeline.Changes
gateway/platforms/base.py: AddSUPPORTED_IMAGE_DOCUMENT_TYPESconstant (mirrors existingSUPPORTED_VIDEO_TYPESpattern)gateway/platforms/telegram.py:.jpg/.jpeg→image/jpegdedup)cache_image_from_bytes+ vision pipelineWhy this approach
base.py— consistent withSUPPORTED_VIDEO_TYPES, reusable by other platformsimage/*SUPPORTED_DOCUMENT_TYPES(images are not documents)Related Issues
Closes #20128
Closes #18620
Supersedes
This PR consolidates the fixes from several open PRs: