Enhance image handling in chat attachments#301657
Merged
Conversation
- Introduced coerceImageBuffer function to standardize image data handling. - Updated ImageAttachmentWidget to utilize coerced image data for carousel display. - Enhanced collectCarouselSections to merge request and response images. - Added extractImagesFromChatRequest function for extracting user-attached images. - Expanded test coverage for image extraction and carousel section collection.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for showing user-attached images (from chat requests) in the Chat Image Carousel, alongside existing response/tool/inline-reference images.
Changes:
- Introduces
coerceImageBufferandextractImagesFromChatRequestto normalize and extract image attachment data from chat requests. - Updates carousel section collection to merge request attachment images with response-derived images, including pending-request handling.
- Expands unit tests to cover request image extraction and carousel section collection behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/chatImageExtraction.ts | Adds request-image extraction and buffer coercion utilities. |
| src/vs/workbench/contrib/chat/browser/chatImageCarouselService.ts | Updates carousel section collection to include request attachments and pending requests. |
| src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts | Uses coerced image data and enables carousel opening for more attachment shapes. |
| src/vs/workbench/contrib/chat/test/common/chatImageExtraction.test.ts | Adds tests for extracting images from chat requests. |
| src/vs/workbench/contrib/chat/test/browser/chatImageCarouselService.test.ts | Adds tests for request/response merging and pending request sections. |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts:460
- This condition enables pointer cursor + keyboard open handlers even when only imageData is present and the carousel feature is disabled, leading to a clickable UI that does nothing. Consider changing the condition to require either a resource, or (imageData && ImageCarouselEnabled) so interaction affordances match actual behavior.
// Wire up click + keyboard (Enter/Space) open handlers
if (resource || imageData) {
this.element.style.cursor = 'pointer';
this._register(registerOpenEditorListeners(this.element, async () => {
await clickHandler();
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatImageCarouselService.ts
Outdated
Show resolved
Hide resolved
justschen
approved these changes
Mar 14, 2026
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.
Support image attachments in chat request in Image Carousel.