Skip to content

Make chat image detail configurable - #328096

Draft
Zeqi Lin (zelinms) wants to merge 2 commits into
microsoft:mainfrom
zelinms:copilot/configurable-image-detail
Draft

Make chat image detail configurable#328096
Zeqi Lin (zelinms) wants to merge 2 commits into
microsoft:mainfrom
zelinms:copilot/configurable-image-detail

Conversation

@zelinms

Copy link
Copy Markdown
Contributor

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b2bbfcc7-4927-4622-b6e6-17295cfbf82a
Copilot AI review requested due to automatic review settings July 29, 2026 20:46
@zelinms
Zeqi Lin (zelinms) marked this pull request as draft July 29, 2026 20:46

Copilot AI 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.

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.imageDetail setting.
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants