Skip to content

feat: paste an image into the chat input to attach it - #85

Merged
mm-zacharydavison merged 1 commit into
mainfrom
masudahiroto/composer-file-intake
Sep 11, 2026
Merged

mm-zacharydavison merged 1 commit into
mainfrom
masudahiroto/composer-file-intake

Conversation

@masudahiroto

@masudahiroto masudahiroto commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

AI Disclosure: This PR description is written by AI.

You can now paste an image from the clipboard into the chat input and have it attached. The intended use is attaching a screenshot you just took.

The Composer slot now receives onAddFiles, which runs files through the chat's own file handling (validation, preview, transformers). DefaultComposer uses it to support paste, and the example's custom composer does the same.

When the clipboard also carries text, the text insertion is left alone and the file is attached alongside it.

🤖 Generated with Claude Code

The Composer slot only received onOpenFilePicker, which is an action rather
than the ability to take files in, so no path that produces a File without the
OS picker could be wired up from a slot. Add `onAddFiles` next to the existing
flat props, so the change is additive and a type published in 1.18.0 keeps
working.

The built-in composer now attaches files pasted into it. The decision to claim
the paste is made synchronously from the clipboard types, so text is never
lost, and files are handed over unfiltered so a rejection surfaces its reason.

Files arriving with an empty name (screenshots in some browsers) get one filled
in from their MIME type; a name the browser did provide is left alone.

`fileUploadEnabled` keeps meaning "file upload is configured" rather than
folding in "no run in flight", which would make the attach button disappear for
the length of every run instead of greying out. The composer slot already
receives `loading`, so a composer that wants both facts can combine them.

AILAB-370

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@masudahiroto
masudahiroto marked this pull request as ready for review September 11, 2026 09:39

@mm-zacharydavison mm-zacharydavison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! nice feature

@mm-zacharydavison
mm-zacharydavison merged commit 070954f into main Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants