Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"@microsoft/dev-tunnels-ssh-tcp": "^3.12.22",
"@parcel/watcher": "^2.5.6",
"@types/semver": "^7.5.8",
"@vscode/codicons": "^0.0.46-44",
"@vscode/codicons": "^0.0.46-46",
"@vscode/copilot-api": "^0.5.2",
"@vscode/deviceid": "^0.1.1",
"@vscode/diff": "0.0.2-7",
Expand Down
8 changes: 4 additions & 4 deletions remote/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.13",
"@microsoft/1ds-post-js": "^3.2.13",
"@vscode/codicons": "^0.0.46-44",
"@vscode/codicons": "^0.0.46-46",
"@vscode/iconv-lite-umd": "0.7.1",
"@vscode/tree-sitter-wasm": "^0.3.1",
"@vscode/vscode-languagedetection": "1.0.23",
Expand Down
1 change: 1 addition & 0 deletions src/vs/base/common/codiconsLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,4 +772,5 @@ export const codiconsLibrary = {
gripperCorner: register('gripper-corner', 0xecf6),
meteredConnection: register('metered-connection', 0xecf7),
reportQuestion: register('report-question', 0xecf8),
trophy: register('trophy', 0xecf9),
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ export class SessionComparisonModelSelection extends Disposable implements IMode
readonly summary = derived(this, reader => this.enabled.read(reader)
? getAttemptsSummaryText(this.attempts.read(reader), this._getModelLabel)
: undefined);
/** The composer shows each attempt's own icon instead of the joined name list. */
readonly summaryModelIds = derived(this, reader => this.enabled.read(reader) ? this.attemptModelIds.read(reader) : undefined);
readonly state = derived<IModelPickerComparisonState | undefined>(this, reader => {
const draft = this._draft.read(reader);
if (!draft || !this.available.read(reader)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@
text-overflow: ellipsis;
}

/* One icon per compare-mode attempt, replacing the generic layers icon and joined
* name list; a tight row reads as "a small set of models" at a glance. */
.chat-input-picker-item .action-label.model-picker-split .model-picker-name .chat-input-picker-comparison-attempt-icons {
display: flex;
align-items: center;
flex: 0 0 auto;
gap: var(--vscode-spacing-size20);
}

.chat-input-picker-item .action-label.model-picker-split.compact .model-picker-name {
flex: 0 0 auto;
width: 22px;
Expand Down Expand Up @@ -501,6 +492,16 @@
font-weight: var(--vscode-fontWeight-semiBold);
}

.action-widget .chat-model-picker-tabbar .tabbed-action-list-tabbar-action[data-id='comparison'] {
border: var(--vscode-strokeThickness) solid transparent;
}

.action-widget .chat-model-picker-tabbar .tabbed-action-list-tabbar-action[data-id='comparison'].checked {
color: var(--vscode-inputOption-activeForeground);
background: var(--vscode-inputOption-activeBackground);
border-color: var(--vscode-inputOption-activeBorder);
}

.action-widget .chat-model-picker-tabbar .monaco-custom-radio .monaco-button:focus-visible,
.action-widget .chat-model-picker-tabbar .tabbed-action-list-tabbar-action:focus-visible {
outline: var(--vscode-strokeThickness) solid var(--vscode-focusBorder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ export interface IModelPickerComparison {
readonly available: IObservable<boolean>;
/** Composer label for the committed selection, independent of the open setup draft. */
readonly summary: IObservable<string | undefined>;
/**
* One model id per attempt in the committed selection (duplicated for extra variant
* attempts of the same model), parallel to `summary`. When all ids are distinct, the
* composer shows each attempt's own icon; repeated ids retain the labeled summary.
*/
readonly summaryModelIds?: IObservable<readonly string[] | undefined>;
readonly state: IObservable<IModelPickerComparisonState | undefined>;
readonly label: string;
readonly startCommandId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,13 @@ export class TabbedModelPicker extends Disposable {
// Grouped with Search at the end of the tab bar, away from the provider tabs.
actions.push({
id: 'comparison',
<<<<<<< HEAD
icon: Codicon.layers,
tooltip: this._labelWithKeybinding(comparison.label, comparison.startCommandId),
=======
icon: Codicon.trophy,
tooltip: comparison.label,
>>>>>>> bd48520ea99 ([cherry-pick] chat: use trophy icon for model comparison toggle (#342710))
Comment on lines +769 to +775
alignEnd: true,
useManagedHover: true,
checked: !!comparison.state.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as dom from '../../../../../../../base/browser/dom.js';
import { StandardKeyboardEvent } from '../../../../../../../base/browser/keyboardEvent.js';
import { EventType as TouchEventType, Gesture } from '../../../../../../../base/browser/touch.js';
import { renderIcon } from '../../../../../../../base/browser/ui/iconLabel/iconLabels.js';
import { ThemeIcon } from '../../../../../../../base/common/themables.js';
import { getBaseLayerHoverDelegate } from '../../../../../../../base/browser/ui/hover/hoverDelegate2.js';
import { getDefaultHoverDelegate } from '../../../../../../../base/browser/ui/hover/hoverDelegateFactory.js';
import { IStringDictionary } from '../../../../../../../base/common/collections.js';
Expand Down Expand Up @@ -205,7 +204,6 @@ export class ModelPickerWidget extends Disposable {
if (this._delegate.comparison) {
this._register(autorun(reader => {
this._delegate.comparison?.summary.read(reader);
this._delegate.comparison?.summaryModelIds?.read(reader);
if (!this._delegate.comparison?.available.read(reader)) {
this._tabbedPicker.value?.hide();
}
Expand Down Expand Up @@ -894,32 +892,14 @@ export class ModelPickerWidget extends Disposable {

// --- Name section ---
const nameChildren: (HTMLElement | string)[] = [];
// A comparison of distinct models shows one icon per attempt instead of the generic
// layers icon when every model resolves to one. Repeated models keep the labeled
// summary so configured variants remain distinguishable.
const summaryModelIds = comparisonSummary && this._delegate.getPresentationOptions().showModelIcon
? this._delegate.comparison?.summaryModelIds?.get()
: undefined;
const hasRepeatedSummaryModelIds = !!summaryModelIds && new Set(summaryModelIds).size !== summaryModelIds.length;
const compact = this._compact?.get() ?? false;
const minimal = this._minimal?.get() ?? false;
const summaryIcons = summaryModelIds?.length
? summaryModelIds.map(modelId => {
const model = (this._delegate.getComparisonModels?.() ?? models).find(candidate => candidate.identifier === modelId);
return model && getCompactModelPickerIcon(model);
})
const modelIcon = comparisonSummary ? Codicon.trophy : shownModel
? (this._delegate.getPresentationOptions().showModelIcon
? getCompactModelPickerIcon(shownModel)
: shownModel.metadata.statusIcon ? getCompactCodicon(shownModel.metadata.statusIcon) : undefined)
: undefined;
const showSummaryIcons = !compact && !minimal && !hasRepeatedSummaryModelIds && !!summaryIcons?.every((icon): icon is ThemeIcon => !!icon);
const modelIcon = showSummaryIcons
? undefined
: comparisonSummary ? Codicon.layers : shownModel
? (this._delegate.getPresentationOptions().showModelIcon
? getCompactModelPickerIcon(shownModel)
: shownModel.metadata.statusIcon ? getCompactCodicon(shownModel.metadata.statusIcon) : undefined)
: undefined;
if (showSummaryIcons && summaryIcons && !noModelsAvailable) {
nameChildren.push(dom.$('span.chat-input-picker-comparison-attempt-icons', undefined, ...summaryIcons.map(icon => renderIcon(icon))));
} else if (modelIcon && !noModelsAvailable) {
if (modelIcon && !noModelsAvailable) {
nameChildren.push(renderIcon(modelIcon));
}
// A "Models" placeholder (no badge) beats a dead-end label while unavailable — the hover and
Expand All @@ -933,7 +913,7 @@ export class ModelPickerWidget extends Disposable {
: genericNoModels
? localize('chat.modelPicker.noModels', "No models available")
: (name ?? localize('chat.modelPicker.auto', "Auto"));
const showModelLabel = hasRepeatedSummaryModelIds || (!compact || !modelIcon || noModelsAvailable) && !showSummaryIcons;
const showModelLabel = (!comparisonSummary || noModelsAvailable) && (!compact || !modelIcon || noModelsAvailable);
if (showModelLabel) {
nameChildren.push(dom.$('span.chat-input-picker-label', undefined, modelLabel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ suite('ModelPickerActionItem', () => {
const { domNode } = renderPicker(createModel('First'), {
comparison: upcastPartial<IModelPickerComparison>({ available: constObservable(true), summary, state }),
});
const label = () => domNode.querySelector('.chat-input-picker-label')?.textContent;
const label = () => ({
text: domNode.querySelector('.model-picker-name .chat-input-picker-label')?.textContent,
trophy: !!domNode.querySelector('.codicon-trophy'),
ariaLabel: domNode.querySelector('.model-picker-name')?.getAttribute('aria-label'),
});
const initial = label();
state.set({
title: 'Attempts', description: 'Select models.', summary: '10 Attempts', selectedModelIds: ['model'],
Expand All @@ -326,63 +330,74 @@ suite('ModelPickerActionItem', () => {
summary.set('3 Attempts', undefined);
const committed = label();
state.set(undefined, undefined);
assert.deepStrictEqual({ initial, duringSetup, committed, dismissed: label() }, {
initial: 'First', duringSetup: 'First', committed: '3 Attempts', dismissed: '3 Attempts',
const dismissed = label();
summary.set(undefined, undefined);
assert.deepStrictEqual({ initial, duringSetup, committed, dismissed, reset: label() }, {
initial: { text: 'First', trophy: false, ariaLabel: 'Models, First' },
duringSetup: { text: 'First', trophy: false, ariaLabel: 'Models, First' },
committed: { text: undefined, trophy: true, ariaLabel: 'Models, 3 Attempts' },
dismissed: { text: undefined, trophy: true, ariaLabel: 'Models, 3 Attempts' },
reset: { text: 'First', trophy: false, ariaLabel: 'Models, First' },
});
});

test('composer keeps the labeled summary when variants repeat a model icon', () => {
test('composer uses one trophy and preserves variant names in its accessible label and hover', () => {
const model = createModel('First');
const { domNode } = renderPicker(model, {
const { domNode, getHoverContents } = renderPicker(model, {
compact: true,
showModelIcon: true,
comparison: upcastPartial<IModelPickerComparison>({
available: constObservable(true),
summary: constObservable('First, First Max'),
summaryModelIds: constObservable([model.identifier, model.identifier]),
state: constObservable(undefined),
}),
});

assert.deepStrictEqual({
label: domNode.querySelector('.chat-input-picker-label')?.textContent,
attemptIcons: domNode.querySelector('.chat-input-picker-comparison-attempt-icons')?.childElementCount,
trophies: domNode.querySelectorAll('.model-picker-name > .codicon-trophy').length,
icons: domNode.querySelectorAll('.model-picker-name > .codicon').length,
ariaLabel: domNode.querySelector('.model-picker-name')?.getAttribute('aria-label'),
hover: getHoverContents(),
}, {
label: 'First, First Max',
attemptIcons: undefined,
label: undefined,
trophies: 1,
icons: 1,
ariaLabel: 'Models, First, First Max',
hover: 'Models • First, First Max',
});
});

for (const presentation of [
{ name: 'expanded', compact: false, minimal: false, attemptIcons: 2, layers: false },
{ name: 'compact', compact: true, minimal: false, attemptIcons: undefined, layers: true },
{ name: 'minimal', compact: false, minimal: true, attemptIcons: undefined, layers: true },
{ name: 'expanded', compact: false, minimal: false, showModelIcon: true },
{ name: 'compact', compact: true, minimal: false, showModelIcon: true },
{ name: 'minimal', compact: false, minimal: true, showModelIcon: true },
{ name: 'without model icons', compact: false, minimal: false, showModelIcon: false },
]) {
test(`composer uses ${presentation.name === 'expanded' ? 'attempt icons' : 'the layers fallback'} for ${presentation.name === 'expanded' ? 'an' : 'a'} ${presentation.name} distinct-model comparison`, () => {
test(`composer uses one trophy for a distinct-model comparison (${presentation.name})`, () => {
const first = createModel('First');
const second = createModel('Second');
const { domNode } = renderPicker(first, {
compact: presentation.compact,
minimal: presentation.minimal,
models: [first, second],
showModelIcon: true,
showModelIcon: presentation.showModelIcon,
comparison: upcastPartial<IModelPickerComparison>({
available: constObservable(true),
summary: constObservable('First, Second'),
summaryModelIds: constObservable([first.identifier, second.identifier]),
state: constObservable(undefined),
}),
});

assert.deepStrictEqual({
attemptIcons: domNode.querySelector('.chat-input-picker-comparison-attempt-icons')?.childElementCount,
layers: !!domNode.querySelector('.codicon-layers'),
trophies: domNode.querySelectorAll('.model-picker-name > .codicon-trophy').length,
icons: domNode.querySelectorAll('.model-picker-name > .codicon').length,
label: domNode.querySelector('.chat-input-picker-label')?.textContent,
ariaLabel: domNode.querySelector('.model-picker-name')?.getAttribute('aria-label'),
}, {
attemptIcons: presentation.attemptIcons,
layers: presentation.layers,
trophies: 1,
icons: 1,
label: undefined,
ariaLabel: 'Models, First, Second',
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,24 +679,75 @@ suite('TabbedModelPicker', () => {
const hides: boolean[] = [];
disposables.add(picker.onDidHide(event => hides.push(event.finishedComparison)));
const searchAction = element(popup, '[data-id="search"]');
popup.style.setProperty('--vscode-strokeThickness', '1px');
popup.style.setProperty('--vscode-inputOption-activeBackground', 'rgb(10, 20, 30)');
popup.style.setProperty('--vscode-inputOption-activeBorder', 'rgb(40, 50, 60)');
const comparisonActionState = () => {
const action = element(popup, '[data-id="comparison"]');
const style = dom.getWindow(action).getComputedStyle(action);
return {
ariaLabel: action.getAttribute('aria-label'),
htmlTitle: action.getAttribute('title'),
pressed: action.getAttribute('aria-pressed'),
trophy: !!action.querySelector('.codicon-trophy'),
alignedWithSearch: action.classList.contains('align-end'),
background: style.backgroundColor,
border: style.borderColor,
width: action.offsetWidth,
height: action.offsetHeight,
};
};
assert.deepStrictEqual({
actions: [...popup.querySelectorAll<HTMLElement>('.tabbed-action-list-tabbar > .tabbed-action-list-tabbar-action')].map(action => action.dataset.id),
<<<<<<< HEAD
comparison: popup.querySelector('[data-id="comparison"]')?.getAttribute('aria-pressed'),
footer: element(popup, '.tabbed-action-list-footer .monaco-button').getAttribute('aria-label'),
=======
comparison: comparisonActionState(),
>>>>>>> bd48520ea99 ([cherry-pick] chat: use trophy icon for model comparison toggle (#342710))
search: {
ariaLabel: searchAction.getAttribute('aria-label'),
htmlTitle: searchAction.getAttribute('title'),
},
}, {
actions: ['comparison', 'search'],
<<<<<<< HEAD
comparison: 'false',
footer: 'Send Query to Multiple Models',
=======
comparison: {
ariaLabel: 'Compare Models',
htmlTitle: null,
pressed: 'false',
trophy: true,
alignedWithSearch: true,
background: 'rgba(0, 0, 0, 0)',
border: 'rgba(0, 0, 0, 0)',
width: 28,
height: 28,
},
>>>>>>> bd48520ea99 ([cherry-pick] chat: use trophy icon for model comparison toggle (#342710))
search: {
ariaLabel: 'Search Models',
htmlTitle: 'Search Models',
},
});
<<<<<<< HEAD
element(popup, '.tabbed-action-list-footer .monaco-button').click();
=======
comparisonAction.click();
assert.deepStrictEqual(comparisonActionState(), {
ariaLabel: 'Compare Models',
htmlTitle: null,
pressed: 'true',
trophy: true,
alignedWithSearch: true,
background: 'rgb(10, 20, 30)',
border: 'rgb(40, 50, 60)',
width: 28,
height: 28,
});
>>>>>>> bd48520ea99 ([cherry-pick] chat: use trophy icon for model comparison toggle (#342710))
const footerButtons = () => [...popup.querySelectorAll<HTMLElement>('.model-picker-comparison-actions .monaco-button')].filter(button => button.style.display !== 'none');
/** Each footer button's label, with `(disabled)` when it is shown but cannot be used. */
const buttons = () => footerButtons().map(button => `${button.getAttribute('aria-label') ?? button.textContent?.trim()}${button.classList.contains('disabled') ? ' (disabled)' : ''}`);
Expand Down
Loading