Make chat image detail configurable - #328096
Draft
Zeqi Lin (zelinms) wants to merge 2 commits into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b2bbfcc7-4927-4622-b6e6-17295cfbf82a
Contributor
There was a problem hiding this comment.
Pull request overview
Adds configurable image-detail levels for Copilot chat attachments, including model-gated original detail and token-cost estimation.
Changes:
- Adds the
github.copilot.chat.imageDetailsetting. - Applies configured detail across attachment, file-variable, and tool-result images.
- Adds capability checks, token estimation, and tests.
Show a summary per file
| File | Description |
|---|---|
extensions/copilot/package.json |
Registers the setting and values. |
extensions/copilot/package.nls.json |
Adds localized setting descriptions. |
extensions/copilot/src/platform/configuration/common/configurationService.ts |
Defines the configuration key. |
extensions/copilot/src/platform/endpoint/common/chatModelCapabilities.ts |
Identifies models supporting original detail. |
extensions/copilot/src/platform/tokenizer/node/tokenizer.ts |
Estimates original and automatic image costs. |
extensions/copilot/src/platform/tokenizer/node/test/tokenizer.spec.ts |
Tests patch-based estimation. |
extensions/copilot/src/extension/prompts/node/panel/image.tsx |
Centralizes configured image rendering. |
extensions/copilot/src/extension/prompts/node/panel/toolCalling.tsx |
Applies configuration to tool-result images. |
extensions/copilot/src/extension/prompts/node/panel/fileVariable.tsx |
Applies configuration to file images. |
extensions/copilot/src/extension/prompts/node/panel/test/image.spec.tsx |
Tests detail selection and fallback. |
extensions/copilot/src/extension/prompts/node/panel/test/fileVariable.spec.ts |
Tests file-image configuration. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Medium
Comment on lines
+344
to
+346
| // `auto` may resolve to `original`; use the conservative patch-based estimate. | ||
| if (detail === 'original' || detail === 'auto') { | ||
| return Math.ceil(width / 32) * Math.ceil(height / 32); |
Comment on lines
+53
to
+56
| const configuredDetail = this.configurationService.getConfig(ConfigKey.ChatImageDetail); | ||
| const detail = configuredDetail === 'original' && !modelSupportsOriginalImageDetail(this.promptEndpoint) ? 'high' : configuredDetail; | ||
| // prompt-tsx has not added `original` to its image detail type yet, but preserves the value at runtime. | ||
| return <BaseImage src={this.props.src} detail={detail as 'auto' | 'low' | 'high'} mimeType={this.props.mimeType} />; |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b2bbfcc7-4927-4622-b6e6-17295cfbf82a
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.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com