feat: add image drag-drop and paste support to codegen chat#12351
Open
rlueder wants to merge 1 commit intogitbutlerapp:masterfrom
Open
feat: add image drag-drop and paste support to codegen chat#12351rlueder wants to merge 1 commit intogitbutlerapp:masterfrom
rlueder wants to merge 1 commit intogitbutlerapp:masterfrom
Conversation
Users can now drag-drop or paste images (PNG, JPG, GIF, WebP, SVG, BMP) into the Claude Code chat input. Images are stored as base64 in the attachment service, displayed as thumbnails in the attachment list, and written to temp files on submit so Claude can view them via its Read tool. Key changes: - Add 'image' variant to PromptAttachment (TS + Rust + legacy) - Wire FileUploadPlugin into CodegenInput with 5MB size limit - Render image thumbnails in AttachmentList - Decode base64 and write to temp files in format_message_with_attachments - Add base64 crate dependency to but-claude Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@rlueder is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
hey! thanks for the PR - do we know if this works on various platforms? I remember there being a drag and drop of external files on mac |
krlvi
reviewed
Feb 16, 2026
|
|
||
| // Write to a temp file in the system temp directory | ||
| let filename = format!("{}.{}", uuid::Uuid::new_v4(), ext); | ||
| let temp_dir = std::env::temp_dir().join("gitbutler-images"); |
Member
There was a problem hiding this comment.
we might wanna use the "tempfile" crate for this
Author
Works well on mac and Linux, I have a Windows machine I can give it a go and will report back. |
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
How it works
Since
claude_agent_sdk_rsonly exposesclient.query(&str)(text-only), images can't be sent as native multimodal content blocks. Instead:{tmp}/gitbutler-images/{uuid}.{ext}, and the message tells Claude the file path so it can use itsReadtool to view itScreenshot
Changes
apps/desktop/src/lib/codegen/types.tsimagevariant toPromptAttachmentpackages/ui/src/lib/index.tsFileUploadPluginapps/desktop/src/components/codegen/CodegenInput.svelteFileUploadplugin, implementhandleFileDropapps/desktop/src/components/codegen/AttachmentList.sveltecrates/but-claude/src/lib.rsImage(ImageAttachment)to enumcrates/but-claude/src/legacy.rsImagevariant +Fromimplcrates/but-claude/src/session.rsvalidate_attachmentandformat_message_with_attachmentsCargo.toml/crates/but-claude/Cargo.tomlbase64dependencyTest plan
🤖 Generated with Claude Code