Skip to content

fix(gateway): add image types to SUPPORTED_DOCUMENT_TYPES#18142

Closed
miaogaolin wants to merge 1 commit into
NousResearch:mainfrom
miaogaolin:fix/add-image-types-to-document-support
Closed

fix(gateway): add image types to SUPPORTED_DOCUMENT_TYPES#18142
miaogaolin wants to merge 1 commit into
NousResearch:mainfrom
miaogaolin:fix/add-image-types-to-document-support

Conversation

@miaogaolin

Copy link
Copy Markdown

When users send images as documents on messaging platforms (Telegram, Discord, etc.), they get "Unsupported document type '.png'" error and the image data is lost.

This fix adds .png, .jpg, .jpeg, .webp, .gif to SUPPORTED_DOCUMENT_TYPES so images sent as documents are properly cached and available in the conversation context.

The existing download, cache, and injection logic already handles these types — only the type dictionary needed updating.

Allow .png/.jpg/.jpeg/.webp/.gif to be accepted as document types.
This prevents 'Unsupported document type' errors when users send
images as documents on messaging platforms.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #16710 — same fix adding image extensions to SUPPORTED_DOCUMENT_TYPES in gateway/platforms/base.py.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #16710 — same fix adding image extensions to SUPPORTED_DOCUMENT_TYPES in gateway/platforms/base.py.

@teknium1

Copy link
Copy Markdown
Contributor

This appears to be implemented on current main via the later image-document routing path. Automated hermes-sweeper review.

Evidence:

  • gateway/platforms/base.py:1150 defines SUPPORTED_IMAGE_DOCUMENT_TYPES for .jpg, .jpeg, .png, .webp, and .gif.
  • gateway/platforms/base.py:1355 routes those extensions and image/* MIME types through cache_image_from_bytes(...) and returns CachedMedia(..., "image", ...), so image documents are preserved for vision instead of treated as unsupported generic documents.
  • gateway/platforms/telegram.py:5559 handles Telegram documents whose extension is an image extension or whose MIME type starts with image/, downloading and caching them as images before the normal document rejection path.
  • The proving commit is 77c4675a50db7abbfd191d4fba4746b4f3e1559e (fix(telegram): route image documents (.png/.jpg/.webp/.gif) through vision pipeline).

The current implementation intentionally uses a separate image-document path rather than adding image extensions to SUPPORTED_DOCUMENT_TYPES, but it fixes the reported failure mode.

@teknium1 teknium1 closed this Jun 10, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants