Compress oversized images client-side in AI chat#1456
Conversation
Instead of rejecting images that exceed the 3MB limit with an error toast, compress them on the client using canvas before attaching. - Add compress-image.ts utility: resizes to max 2048px, encodes as JPEG with decreasing quality until the result fits within ~1.5MB. - Update ImageAttachmentAdapter to compress in the add step instead of throwing on oversized files. - Remove pre-rejection logic from ComposerAttachmentsAddButton so all selected images flow through the adapter (which compresses them as needed). Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Compress images that exceed the 3MB limit on the client using canvas instead of rejecting them with an error toast.
compress-image.ts: resizes to max 2048px, encodes as JPEG with decreasing quality until within ~1.5MBImageAttachmentAdapter.addnow compresses oversized files instead of throwingComposerAttachmentsAddButtonLink to Devin session: https://app.devin.ai/sessions/f6bde30365774f2183da9226b8d0141a
Requested by: @N2D4