Skip to content

fix: bound multi-image chat payloads#784

Draft
adity982 wants to merge 1 commit into
dataelement:mainfrom
adity982:agent/compress-chat-image-payloads
Draft

fix: bound multi-image chat payloads#784
adity982 wants to merge 1 commit into
dataelement:mainfrom
adity982:agent/compress-chat-image-payloads

Conversation

@adity982

Copy link
Copy Markdown

Summary

  • keep the original uploaded image unchanged in workspace storage
  • generate a bounded vision preview (512 KiB, 1568 px maximum edge) for the chat payload
  • normalize EXIF orientation and transparent images while compressing oversized inputs
  • cover unchanged small images and bounded large-image previews with regression tests

Why

The upload endpoint embedded each original image as base64 in the WebSocket message. A single allowed 10 MiB image expands beyond 13 MiB as base64, so a multi-image message can exceed practical frame limits and lose image context. Bounding only the model-facing preview keeps multi-image payloads manageable without degrading the stored original.

Validation

  • python -m pytest tests/test_chat_upload_images.py -q — 2 passed
  • uvx ruff check app/services/chat_image_preview.py tests/test_chat_upload_images.py
  • uvx ruff check --select I app/api/upload.py

Addresses #776.

Signed-off-by: Aditya Datta <crazyme07071996@gmail.com>
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.

1 participant