Skip to content

Send pasted images with AI chat messages - #740

Open
IzonIcy wants to merge 1 commit into
athasdev:mainfrom
IzonIcy:ai-chat-paste-images
Open

Send pasted images with AI chat messages#740
IzonIcy wants to merge 1 commit into
athasdev:mainfrom
IzonIcy:ai-chat-paste-images

Conversation

@IzonIcy

@IzonIcy IzonIcy commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Send pasted images with AI chat messages

Problem

Pasting an image into the AI chat input shows a preview chip, but sending the message silently drops every image. handleSendMessage in the input bar captures pastedImages and then throws them away, leaving a TODO: include images in message in the code.

Changes

  • The chat input passes captured images through onSendMessage(text, images) instead of dropping them.
  • The chat surface decodes image data URLs into { data, mediaType } pairs (new pure helper in src/features/ai/utils/pasted-images.ts), attaches them to the persisted user message (Message.images already existed), keeps them queued with text while a response is streaming, and forwards them through the pending agent launch request.
  • ACP agents receive images as prompt content blocks. The ACP protocol already supports image blocks and the Rust bridge already models AcpContentBlock::Image { data, media_type }; this adds the matching variant to the frontend's AcpPromptContentBlock type and appends the blocks in buildPrompt.
  • Custom HTTP providers keep their current text-only requests. Each provider formats vision payloads differently (OpenAI content arrays vs Anthropic source blocks etc.), so wiring those is follow-up work rather than something to rush into this change.

Note: messages containing only an image and no text are still ignored at the same guard as before; this change does not alter that behavior.

Testing

  • New unit tests for data URL decoding: src/features/ai/tests/pasted-images.test.ts (5 tests).
  • Full suite passes: 1755 tests across 358 files.
  • bun run typecheck, lint, and architecture checks pass.

I agree to the Contributor License and Feedback Agreement.

Pasting an image into the chat input showed a preview chip, but sending
the message dropped the images on the floor. The send path only carried
the text content, and the TODO in the input bar acknowledged it.

The input bar now passes captured images through onSendMessage. The
chat surface converts their data URLs into data and media type pairs,
attaches them to the persisted user message, queues them alongside text
while a response is streaming, and forwards them when launching a new
agent from the initial composer.

ACP agents receive the images as prompt content blocks, which the ACP
protocol already supports and the Rust bridge already models. The
prompt block type gains the matching image variant. Custom HTTP
providers keep their current text-only requests; wiring vision payloads
per provider is left as follow-up work since each provider formats
images differently.

Adds unit tests for data URL decoding under src/features/ai/tests.
Copilot AI lite review requested due to automatic review settings August 23, 2026 01:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants