Skip to content

Commit

Permalink
Merge pull request #238711 from microsoft/ben/abstract-leech
Browse files Browse the repository at this point in the history
chat - offer entry to enable more models if Copilot Free user
  • Loading branch information
bpasero authored Jan 24, 2025
2 parents 42ac4fb + 5331ff2 commit dcb91f8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/vs/workbench/contrib/chat/browser/chatInputPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { createInstantHoverDelegate, getDefaultHoverDelegate } from '../../../..
import { HoverPosition } from '../../../../base/browser/ui/hover/hoverWidget.js';
import { renderLabelWithIcons } from '../../../../base/browser/ui/iconLabel/iconLabels.js';
import { ProgressBar } from '../../../../base/browser/ui/progressbar/progressbar.js';
import { IAction } from '../../../../base/common/actions.js';
import { IAction, Separator, toAction } from '../../../../base/common/actions.js';
import { coalesce } from '../../../../base/common/arrays.js';
import { Promises } from '../../../../base/common/async.js';
import { Codicon } from '../../../../base/common/codicons.js';
Expand Down Expand Up @@ -1601,7 +1601,8 @@ class ModelPickerActionViewItem extends MenuEntryActionViewItem {
@IThemeService themeService: IThemeService,
@IContextMenuService contextMenuService: IContextMenuService,
@ILanguageModelsService private readonly _languageModelsService: ILanguageModelsService,
@IAccessibilityService _accessibilityService: IAccessibilityService
@IAccessibilityService _accessibilityService: IAccessibilityService,
@ICommandService private readonly _commandService: ICommandService
) {
super(action, options, keybindingService, notificationService, contextKeyService, themeService, contextMenuService, _accessibilityService);

Expand Down Expand Up @@ -1660,7 +1661,16 @@ class ModelPickerActionViewItem extends MenuEntryActionViewItem {
models.sort((a, b) => a.model.name.localeCompare(b.model.name));
this._contextMenuService.showContextMenu({
getAnchor: () => this.element!,
getActions: () => models.map(entry => setLanguageModelAction(entry.id, entry.model)),
getActions: () => {
const actions = models.map(entry => setLanguageModelAction(entry.id, entry.model));

if (this._contextKeyService.getContextKeyValue<boolean>(ChatContextKeys.Setup.limited.key) === true) {
actions.push(new Separator());
actions.push(toAction({ id: 'moreModels', label: localize('chat.moreModels', "Enable More Models..."), run: () => this._commandService.executeCommand('workbench.action.chat.upgradePlan') }));
}

return actions;
},
});
}
}
Expand Down

0 comments on commit dcb91f8

Please sign in to comment.