Skip to content

make sure images are resized when coming from tool calls#4707

Merged
justschen merged 1 commit intomainfrom
justin/zweilous
Mar 26, 2026
Merged

make sure images are resized when coming from tool calls#4707
justschen merged 1 commit intomainfrom
justin/zweilous

Conversation

@justschen
Copy link
Contributor

resize in this final image to tsx part.

there may be double resizing ocurring for some images, but sufficiently small images wont go thru an extra resize

Copilot AI review requested due to automatic review settings March 26, 2026 01:46
@justschen justschen enabled auto-merge March 26, 2026 01:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures images produced by tool calls are resized before being embedded into prompt-tsx <Image> elements or uploaded as chat image attachments, reducing token/context consumption when tools return images.

Changes:

  • Resize tool-result LanguageModelDataPart images via IImageService.resizeImage(...) before base64 encoding.
  • Use the resized image data/mimeType when uploading chat image attachments and when rendering the <Image> TSX element.

@justschen justschen added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 26, 2026
@justschen justschen added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 26, 2026
@justschen justschen added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2026
@justschen justschen added this pull request to the merge queue Mar 26, 2026
@justschen justschen removed this pull request from the merge queue due to a manual request Mar 26, 2026
@justschen justschen added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 0f58ef0 Mar 26, 2026
23 checks passed
@justschen justschen deleted the justin/zweilous branch March 26, 2026 16:00
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.

3 participants