Skip to content

Prevent image attachments on models that don't support image input#207

Open
bilthon wants to merge 2 commits into
Routstr:mainfrom
bilthon:feat/selectively-reject-image-attachments
Open

Prevent image attachments on models that don't support image input#207
bilthon wants to merge 2 commits into
Routstr:mainfrom
bilthon:feat/selectively-reject-image-attachments

Conversation

@bilthon

@bilthon bilthon commented May 29, 2026

Copy link
Copy Markdown

Summary

Today the chat composer lets you attach an image to any model, including text-only ones. Sending that request hits the upstream provider, fails (the model can't accept image input), and still costs sats. This PR gates image attachments to vision-capable models across every entry path, while keeping PDF uploads working everywhere (PDFs are extracted to text client-side and are valid input for text-only models).

A model is treated as image-capable when any of its architecture.input_modalities normalizes to "image" (via the existing normalizeModality helper.

Changes

  • The image/* type hint is removed from the accept attribute of the input tag when a model incapable of processing images is selected, thus preventing the user from selecting an image.
  • Post processing logic removes the file and displays an alert in case the user forces an image or drag-and-drops one.
  • Image files are removed in case the user switches from an image-capable model to one that can't handle them, in case there were image files already selected.

Closes #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent sending requests with images to models that don't support image inputs

1 participant