@codingame/monaco-vscode-katex-common 26.2.2 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +10 -4
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +35 -11
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +3 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +15 -4
- package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +548 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +168 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +67 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +42 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +63 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +77 -73
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +69 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +23 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +381 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +28 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +38 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +109 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +16 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +28 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +226 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +7 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +22 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +11 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +26 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +51 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +20 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +36 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +166 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +16 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +98 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +241 -78
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +29 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +252 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +39 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +36 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +5 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +42 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatCodeBlockPill.css +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +48 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatHookContentPart.css +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +351 -422
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +102 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +69 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/codeBlockPart.css +48 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +47 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +61 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +7 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +41 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +13 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +17 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +310 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +13 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +441 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +24 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +392 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +52 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +271 -187
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +668 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +57 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +2 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +78 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +86 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +393 -134
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +36 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +20 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +25 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +141 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +18 -13
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +108 -27
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +20 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +74 -32
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +11 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +68 -27
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +125 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +8 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +54 -45
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +11 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +172 -112
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +0 -42
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +27 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +83 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +58 -33
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +1 -548
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +0 -187
- /package/vscode/src/vs/{workbench/contrib → platform}/mcp/common/modelContextProtocolApps.js +0 -0
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { append, $, addDisposableListener, EventType, EventHelper, getActiveElement, isHTMLElement, reset } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
5
|
+
import { renderIcon, renderLabelWithIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
6
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
9
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
10
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
11
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
12
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
|
+
import { ActionListItemKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/actionWidget/browser/actionList';
|
|
14
|
+
import { IActionWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actionWidget/browser/actionWidget.service';
|
|
15
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
16
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
17
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
18
|
+
import { TelemetryTrustedValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
19
|
+
import { MANAGE_CHAT_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
20
|
+
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
21
|
+
import { isProUser, ChatEntitlement } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService';
|
|
22
|
+
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
|
|
23
|
+
import { semverExports } from '@codingame/monaco-vscode-api/_virtual/semver';
|
|
24
|
+
import { StateType } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
|
|
25
|
+
import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
|
|
26
|
+
|
|
27
|
+
function isVersionAtLeast(current, required) {
|
|
28
|
+
const currentSemver = semverExports.coerce(current);
|
|
29
|
+
if (!currentSemver) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return semverExports.gte(currentSemver, required);
|
|
33
|
+
}
|
|
34
|
+
function getUpdateHoverContent(updateState) {
|
|
35
|
+
const hoverContent = ( new MarkdownString("", {
|
|
36
|
+
isTrusted: true,
|
|
37
|
+
supportThemeIcons: true
|
|
38
|
+
}));
|
|
39
|
+
switch (updateState) {
|
|
40
|
+
case StateType.AvailableForDownload:
|
|
41
|
+
hoverContent.appendMarkdown(( localize(
|
|
42
|
+
6701,
|
|
43
|
+
"This model requires a newer version of VS Code. [Download Update](command:update.downloadUpdate) to access it."
|
|
44
|
+
)));
|
|
45
|
+
break;
|
|
46
|
+
case StateType.Downloaded:
|
|
47
|
+
case StateType.Ready:
|
|
48
|
+
hoverContent.appendMarkdown(( localize(
|
|
49
|
+
6702,
|
|
50
|
+
"This model requires a newer version of VS Code. [Restart to Update](command:update.restartToUpdate) to access it."
|
|
51
|
+
)));
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
hoverContent.appendMarkdown(( localize(
|
|
55
|
+
6703,
|
|
56
|
+
"This model requires a newer version of VS Code. [Update VS Code](command:update.checkForUpdate) to access it."
|
|
57
|
+
)));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return hoverContent;
|
|
61
|
+
}
|
|
62
|
+
const ModelPickerSection = {
|
|
63
|
+
Other: "other"
|
|
64
|
+
};
|
|
65
|
+
function createModelItem(action, model) {
|
|
66
|
+
return {
|
|
67
|
+
item: action,
|
|
68
|
+
kind: ActionListItemKind.Action,
|
|
69
|
+
label: action.label,
|
|
70
|
+
description: action.description,
|
|
71
|
+
group: {
|
|
72
|
+
title: "",
|
|
73
|
+
icon: action.icon ?? ThemeIcon.fromId(action.checked ? Codicon.check.id : Codicon.blank.id)
|
|
74
|
+
},
|
|
75
|
+
hideIcon: false,
|
|
76
|
+
section: action.section,
|
|
77
|
+
hover: model ? {
|
|
78
|
+
content: getModelHoverContent(model)
|
|
79
|
+
} : undefined
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function createModelAction(model, selectedModelId, onSelect, section) {
|
|
83
|
+
return {
|
|
84
|
+
id: model.identifier,
|
|
85
|
+
enabled: true,
|
|
86
|
+
icon: model.metadata.statusIcon,
|
|
87
|
+
checked: model.identifier === selectedModelId,
|
|
88
|
+
class: undefined,
|
|
89
|
+
description: model.metadata.multiplier ?? model.metadata.detail,
|
|
90
|
+
tooltip: model.metadata.name,
|
|
91
|
+
label: model.metadata.name,
|
|
92
|
+
section,
|
|
93
|
+
run: () => onSelect(model)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function buildModelPickerItems(
|
|
97
|
+
models,
|
|
98
|
+
selectedModelId,
|
|
99
|
+
recentModelIds,
|
|
100
|
+
controlModels,
|
|
101
|
+
currentVSCodeVersion,
|
|
102
|
+
updateStateType,
|
|
103
|
+
onSelect,
|
|
104
|
+
manageSettingsUrl,
|
|
105
|
+
canManageModels,
|
|
106
|
+
commandService,
|
|
107
|
+
chatEntitlementService
|
|
108
|
+
) {
|
|
109
|
+
const items = [];
|
|
110
|
+
if (models.length === 0) {
|
|
111
|
+
items.push(createModelItem({
|
|
112
|
+
id: "auto",
|
|
113
|
+
enabled: true,
|
|
114
|
+
checked: true,
|
|
115
|
+
class: undefined,
|
|
116
|
+
tooltip: ( localize(6704, "Auto")),
|
|
117
|
+
label: ( localize(6704, "Auto")),
|
|
118
|
+
run: () => {}
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
if (!canManageModels) {
|
|
122
|
+
const autoModel = models.find(m => m.metadata.id === "auto" && m.metadata.vendor === "copilot");
|
|
123
|
+
if (autoModel) {
|
|
124
|
+
items.push(
|
|
125
|
+
createModelItem(createModelAction(autoModel, selectedModelId, onSelect), autoModel)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const sortedModels = models.filter(m => m !== autoModel).sort((a, b) => {
|
|
129
|
+
const vendorCmp = a.metadata.vendor.localeCompare(b.metadata.vendor);
|
|
130
|
+
return vendorCmp !== 0 ? vendorCmp : a.metadata.name.localeCompare(b.metadata.name);
|
|
131
|
+
});
|
|
132
|
+
for (const model of sortedModels) {
|
|
133
|
+
items.push(
|
|
134
|
+
createModelItem(createModelAction(model, selectedModelId, onSelect), model)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return items;
|
|
138
|
+
}
|
|
139
|
+
const isPro = isProUser(chatEntitlementService.entitlement);
|
|
140
|
+
let otherModels = [];
|
|
141
|
+
if (models.length) {
|
|
142
|
+
const allModelsMap = ( new Map());
|
|
143
|
+
const modelsByMetadataId = ( new Map());
|
|
144
|
+
for (const model of models) {
|
|
145
|
+
allModelsMap.set(model.identifier, model);
|
|
146
|
+
modelsByMetadataId.set(model.metadata.id, model);
|
|
147
|
+
}
|
|
148
|
+
const placed = ( new Set());
|
|
149
|
+
const markPlaced = (identifierOrId, metadataId) => {
|
|
150
|
+
placed.add(identifierOrId);
|
|
151
|
+
if (metadataId) {
|
|
152
|
+
placed.add(metadataId);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const resolveModel = id => allModelsMap.get(id) ?? modelsByMetadataId.get(id);
|
|
156
|
+
const getUnavailableReason = entry => {
|
|
157
|
+
if (!isPro) {
|
|
158
|
+
return "upgrade";
|
|
159
|
+
}
|
|
160
|
+
if (entry.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, entry.minVSCodeVersion)) {
|
|
161
|
+
return "update";
|
|
162
|
+
}
|
|
163
|
+
return "admin";
|
|
164
|
+
};
|
|
165
|
+
const autoModel = models.find(m => m.metadata.id === "auto" && m.metadata.vendor === "copilot");
|
|
166
|
+
if (autoModel) {
|
|
167
|
+
markPlaced(autoModel.identifier, autoModel.metadata.id);
|
|
168
|
+
items.push(
|
|
169
|
+
createModelItem(createModelAction(autoModel, selectedModelId, onSelect), autoModel)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const promotedItems = [];
|
|
173
|
+
const tryPlaceModel = id => {
|
|
174
|
+
if (( placed.has(id))) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const model = resolveModel(id);
|
|
178
|
+
if (model && !( placed.has(model.identifier))) {
|
|
179
|
+
markPlaced(model.identifier, model.metadata.id);
|
|
180
|
+
const entry = controlModels[model.metadata.id];
|
|
181
|
+
if (entry?.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, entry.minVSCodeVersion)) {
|
|
182
|
+
promotedItems.push({
|
|
183
|
+
kind: "unavailable",
|
|
184
|
+
id: model.metadata.id,
|
|
185
|
+
entry,
|
|
186
|
+
reason: "update"
|
|
187
|
+
});
|
|
188
|
+
} else {
|
|
189
|
+
promotedItems.push({
|
|
190
|
+
kind: "available",
|
|
191
|
+
model
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
if (!model) {
|
|
197
|
+
const entry = controlModels[id];
|
|
198
|
+
if (entry && !entry.exists) {
|
|
199
|
+
markPlaced(id);
|
|
200
|
+
promotedItems.push({
|
|
201
|
+
kind: "unavailable",
|
|
202
|
+
id,
|
|
203
|
+
entry,
|
|
204
|
+
reason: getUnavailableReason(entry)
|
|
205
|
+
});
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
};
|
|
211
|
+
if (selectedModelId && selectedModelId !== autoModel?.identifier) {
|
|
212
|
+
tryPlaceModel(selectedModelId);
|
|
213
|
+
}
|
|
214
|
+
for (const id of recentModelIds) {
|
|
215
|
+
tryPlaceModel(id);
|
|
216
|
+
}
|
|
217
|
+
for (const [entryId, entry] of Object.entries(controlModels)) {
|
|
218
|
+
if (!entry.featured || ( placed.has(entryId))) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const model = resolveModel(entryId);
|
|
222
|
+
if (model && !( placed.has(model.identifier))) {
|
|
223
|
+
markPlaced(model.identifier, model.metadata.id);
|
|
224
|
+
if (entry.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, entry.minVSCodeVersion)) {
|
|
225
|
+
promotedItems.push({
|
|
226
|
+
kind: "unavailable",
|
|
227
|
+
id: entryId,
|
|
228
|
+
entry,
|
|
229
|
+
reason: "update"
|
|
230
|
+
});
|
|
231
|
+
} else {
|
|
232
|
+
promotedItems.push({
|
|
233
|
+
kind: "available",
|
|
234
|
+
model
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
} else if (!model && !entry.exists) {
|
|
238
|
+
markPlaced(entryId);
|
|
239
|
+
promotedItems.push({
|
|
240
|
+
kind: "unavailable",
|
|
241
|
+
id: entryId,
|
|
242
|
+
entry,
|
|
243
|
+
reason: getUnavailableReason(entry)
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
let hasShownActionLink = false;
|
|
248
|
+
if (promotedItems.length > 0) {
|
|
249
|
+
promotedItems.sort((a, b) => {
|
|
250
|
+
const aAvail = a.kind === "available" ? 0 : 1;
|
|
251
|
+
const bAvail = b.kind === "available" ? 0 : 1;
|
|
252
|
+
if (aAvail !== bAvail) {
|
|
253
|
+
return aAvail - bAvail;
|
|
254
|
+
}
|
|
255
|
+
const aName = a.kind === "available" ? a.model.metadata.name : a.entry.label;
|
|
256
|
+
const bName = b.kind === "available" ? b.model.metadata.name : b.entry.label;
|
|
257
|
+
return aName.localeCompare(bName);
|
|
258
|
+
});
|
|
259
|
+
for (const item of promotedItems) {
|
|
260
|
+
if (item.kind === "available") {
|
|
261
|
+
items.push(
|
|
262
|
+
createModelItem(createModelAction(item.model, selectedModelId, onSelect), item.model)
|
|
263
|
+
);
|
|
264
|
+
} else {
|
|
265
|
+
const showActionLink = item.reason === "upgrade" ? !hasShownActionLink : true;
|
|
266
|
+
if (showActionLink && item.reason === "upgrade") {
|
|
267
|
+
hasShownActionLink = true;
|
|
268
|
+
}
|
|
269
|
+
items.push(createUnavailableModelItem(
|
|
270
|
+
item.id,
|
|
271
|
+
item.entry,
|
|
272
|
+
item.reason,
|
|
273
|
+
manageSettingsUrl,
|
|
274
|
+
updateStateType,
|
|
275
|
+
undefined,
|
|
276
|
+
showActionLink
|
|
277
|
+
));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
otherModels = models.filter(m => !( placed.has(m.identifier)) && !( placed.has(m.metadata.id))).sort((a, b) => {
|
|
282
|
+
const aEntry = controlModels[a.metadata.id] ?? controlModels[a.identifier];
|
|
283
|
+
const bEntry = controlModels[b.metadata.id] ?? controlModels[b.identifier];
|
|
284
|
+
const aAvail = aEntry?.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, aEntry.minVSCodeVersion) ? 1 : 0;
|
|
285
|
+
const bAvail = bEntry?.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, bEntry.minVSCodeVersion) ? 1 : 0;
|
|
286
|
+
if (aAvail !== bAvail) {
|
|
287
|
+
return aAvail - bAvail;
|
|
288
|
+
}
|
|
289
|
+
const aCopilot = a.metadata.vendor === "copilot" ? 0 : 1;
|
|
290
|
+
const bCopilot = b.metadata.vendor === "copilot" ? 0 : 1;
|
|
291
|
+
if (aCopilot !== bCopilot) {
|
|
292
|
+
return aCopilot - bCopilot;
|
|
293
|
+
}
|
|
294
|
+
const vendorCmp = a.metadata.vendor.localeCompare(b.metadata.vendor);
|
|
295
|
+
return vendorCmp !== 0 ? vendorCmp : a.metadata.name.localeCompare(b.metadata.name);
|
|
296
|
+
});
|
|
297
|
+
if (otherModels.length > 0) {
|
|
298
|
+
if (items.length > 0) {
|
|
299
|
+
items.push({
|
|
300
|
+
kind: ActionListItemKind.Separator
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
items.push({
|
|
304
|
+
item: {
|
|
305
|
+
id: "otherModels",
|
|
306
|
+
enabled: true,
|
|
307
|
+
checked: false,
|
|
308
|
+
class: undefined,
|
|
309
|
+
tooltip: ( localize(6705, "Other Models")),
|
|
310
|
+
label: ( localize(6705, "Other Models")),
|
|
311
|
+
run: () => {}
|
|
312
|
+
},
|
|
313
|
+
kind: ActionListItemKind.Action,
|
|
314
|
+
label: ( localize(6705, "Other Models")),
|
|
315
|
+
group: {
|
|
316
|
+
title: "",
|
|
317
|
+
icon: Codicon.chevronDown
|
|
318
|
+
},
|
|
319
|
+
hideIcon: false,
|
|
320
|
+
section: ModelPickerSection.Other,
|
|
321
|
+
isSectionToggle: true
|
|
322
|
+
});
|
|
323
|
+
for (const model of otherModels) {
|
|
324
|
+
const entry = controlModels[model.metadata.id] ?? controlModels[model.identifier];
|
|
325
|
+
if (entry?.minVSCodeVersion && !isVersionAtLeast(currentVSCodeVersion, entry.minVSCodeVersion)) {
|
|
326
|
+
items.push(createUnavailableModelItem(
|
|
327
|
+
model.metadata.id,
|
|
328
|
+
entry,
|
|
329
|
+
"update",
|
|
330
|
+
manageSettingsUrl,
|
|
331
|
+
updateStateType,
|
|
332
|
+
ModelPickerSection.Other,
|
|
333
|
+
true
|
|
334
|
+
));
|
|
335
|
+
} else {
|
|
336
|
+
items.push(createModelItem(
|
|
337
|
+
createModelAction(model, selectedModelId, onSelect, ModelPickerSection.Other),
|
|
338
|
+
model
|
|
339
|
+
));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (chatEntitlementService.entitlement === ChatEntitlement.Free || chatEntitlementService.entitlement === ChatEntitlement.Pro || chatEntitlementService.entitlement === ChatEntitlement.ProPlus || chatEntitlementService.entitlement === ChatEntitlement.Business || chatEntitlementService.entitlement === ChatEntitlement.Enterprise || chatEntitlementService.isInternal) {
|
|
345
|
+
items.push({
|
|
346
|
+
kind: ActionListItemKind.Separator,
|
|
347
|
+
section: otherModels.length ? ModelPickerSection.Other : undefined
|
|
348
|
+
});
|
|
349
|
+
items.push({
|
|
350
|
+
item: {
|
|
351
|
+
id: "manageModels",
|
|
352
|
+
enabled: true,
|
|
353
|
+
checked: false,
|
|
354
|
+
class: undefined,
|
|
355
|
+
tooltip: ( localize(6706, "Manage Language Models")),
|
|
356
|
+
label: ( localize(6707, "Manage Models...")),
|
|
357
|
+
run: () => {
|
|
358
|
+
commandService.executeCommand(MANAGE_CHAT_COMMAND_ID);
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
kind: ActionListItemKind.Action,
|
|
362
|
+
label: ( localize(6707, "Manage Models...")),
|
|
363
|
+
group: {
|
|
364
|
+
title: "",
|
|
365
|
+
icon: Codicon.blank
|
|
366
|
+
},
|
|
367
|
+
hideIcon: false,
|
|
368
|
+
section: otherModels.length ? ModelPickerSection.Other : undefined,
|
|
369
|
+
showAlways: true
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
return items;
|
|
373
|
+
}
|
|
374
|
+
function getModelPickerAccessibilityProvider() {
|
|
375
|
+
return {
|
|
376
|
+
isChecked(element) {
|
|
377
|
+
return element.kind === ActionListItemKind.Action ? !!element?.item?.checked : undefined;
|
|
378
|
+
},
|
|
379
|
+
getRole: element => {
|
|
380
|
+
switch (element.kind) {
|
|
381
|
+
case ActionListItemKind.Action:
|
|
382
|
+
return "menuitemradio";
|
|
383
|
+
case ActionListItemKind.Separator:
|
|
384
|
+
return "separator";
|
|
385
|
+
default:
|
|
386
|
+
return "separator";
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
getWidgetRole: () => "menu"
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function createUnavailableModelItem(
|
|
393
|
+
id,
|
|
394
|
+
entry,
|
|
395
|
+
reason,
|
|
396
|
+
manageSettingsUrl,
|
|
397
|
+
updateStateType,
|
|
398
|
+
section,
|
|
399
|
+
showActionLink = true
|
|
400
|
+
) {
|
|
401
|
+
let description;
|
|
402
|
+
if (reason === "upgrade") {
|
|
403
|
+
description = showActionLink ? ( new MarkdownString(( localize(
|
|
404
|
+
6708,
|
|
405
|
+
"[Upgrade your plan](command:workbench.action.chat.upgradePlan \" \")"
|
|
406
|
+
)), {
|
|
407
|
+
isTrusted: true
|
|
408
|
+
})) : undefined;
|
|
409
|
+
} else if (reason === "update") {
|
|
410
|
+
description = ( localize(6709, "Update VS Code"));
|
|
411
|
+
} else {
|
|
412
|
+
description = manageSettingsUrl ? ( new MarkdownString(( localize(6710, "[Contact your admin]({0})", manageSettingsUrl)), {
|
|
413
|
+
isTrusted: true
|
|
414
|
+
})) : ( localize(6711, "Contact your admin"));
|
|
415
|
+
}
|
|
416
|
+
let hoverContent;
|
|
417
|
+
if (reason === "upgrade") {
|
|
418
|
+
hoverContent = ( new MarkdownString("", {
|
|
419
|
+
isTrusted: true,
|
|
420
|
+
supportThemeIcons: true
|
|
421
|
+
}));
|
|
422
|
+
hoverContent.appendMarkdown(( localize(
|
|
423
|
+
6712,
|
|
424
|
+
"[Upgrade your plan](command:workbench.action.chat.upgradePlan \" \") to use this model."
|
|
425
|
+
)));
|
|
426
|
+
} else if (reason === "update") {
|
|
427
|
+
hoverContent = getUpdateHoverContent(updateStateType);
|
|
428
|
+
} else {
|
|
429
|
+
hoverContent = ( new MarkdownString("", {
|
|
430
|
+
isTrusted: true,
|
|
431
|
+
supportThemeIcons: true
|
|
432
|
+
}));
|
|
433
|
+
hoverContent.appendMarkdown(( localize(
|
|
434
|
+
6713,
|
|
435
|
+
"This model is not available. Contact your administrator to enable it."
|
|
436
|
+
)));
|
|
437
|
+
}
|
|
438
|
+
return {
|
|
439
|
+
item: {
|
|
440
|
+
id,
|
|
441
|
+
enabled: false,
|
|
442
|
+
checked: false,
|
|
443
|
+
class: undefined,
|
|
444
|
+
tooltip: entry.label,
|
|
445
|
+
label: entry.label,
|
|
446
|
+
description: typeof description === "string" ? description : undefined,
|
|
447
|
+
run: () => {}
|
|
448
|
+
},
|
|
449
|
+
kind: ActionListItemKind.Action,
|
|
450
|
+
label: entry.label,
|
|
451
|
+
description,
|
|
452
|
+
group: {
|
|
453
|
+
title: "",
|
|
454
|
+
icon: ThemeIcon.fromId(Codicon.blank.id)
|
|
455
|
+
},
|
|
456
|
+
disabled: true,
|
|
457
|
+
hideIcon: false,
|
|
458
|
+
className: "chat-model-picker-unavailable",
|
|
459
|
+
section,
|
|
460
|
+
hover: {
|
|
461
|
+
content: hoverContent
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
let ModelPickerWidget = class ModelPickerWidget extends Disposable {
|
|
466
|
+
get selectedModel() {
|
|
467
|
+
return this._selectedModel;
|
|
468
|
+
}
|
|
469
|
+
get domNode() {
|
|
470
|
+
return this._domNode;
|
|
471
|
+
}
|
|
472
|
+
constructor(
|
|
473
|
+
_delegate,
|
|
474
|
+
_actionWidgetService,
|
|
475
|
+
_commandService,
|
|
476
|
+
_telemetryService,
|
|
477
|
+
_languageModelsService,
|
|
478
|
+
_productService,
|
|
479
|
+
_entitlementService,
|
|
480
|
+
_updateService
|
|
481
|
+
) {
|
|
482
|
+
super();
|
|
483
|
+
this._delegate = _delegate;
|
|
484
|
+
this._actionWidgetService = _actionWidgetService;
|
|
485
|
+
this._commandService = _commandService;
|
|
486
|
+
this._telemetryService = _telemetryService;
|
|
487
|
+
this._languageModelsService = _languageModelsService;
|
|
488
|
+
this._productService = _productService;
|
|
489
|
+
this._entitlementService = _entitlementService;
|
|
490
|
+
this._updateService = _updateService;
|
|
491
|
+
this._onDidChangeSelection = this._register(( new Emitter()));
|
|
492
|
+
this.onDidChangeSelection = this._onDidChangeSelection.event;
|
|
493
|
+
}
|
|
494
|
+
setSelectedModel(model) {
|
|
495
|
+
this._selectedModel = model;
|
|
496
|
+
this._renderLabel();
|
|
497
|
+
}
|
|
498
|
+
setBadge(badge) {
|
|
499
|
+
this._badge = badge;
|
|
500
|
+
this._updateBadge();
|
|
501
|
+
}
|
|
502
|
+
render(container) {
|
|
503
|
+
this._domNode = append(container, $("a.action-label"));
|
|
504
|
+
this._domNode.tabIndex = 0;
|
|
505
|
+
this._domNode.setAttribute("role", "button");
|
|
506
|
+
this._domNode.setAttribute("aria-haspopup", "true");
|
|
507
|
+
this._domNode.setAttribute("aria-expanded", "false");
|
|
508
|
+
this._badgeIcon = append(this._domNode, $("span.model-picker-badge"));
|
|
509
|
+
this._updateBadge();
|
|
510
|
+
this._renderLabel();
|
|
511
|
+
this._register(addDisposableListener(this._domNode, EventType.MOUSE_DOWN, e => {
|
|
512
|
+
if (e.button !== 0) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
EventHelper.stop(e, true);
|
|
516
|
+
this.show();
|
|
517
|
+
}));
|
|
518
|
+
this._register(addDisposableListener(this._domNode, EventType.KEY_DOWN, e => {
|
|
519
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
520
|
+
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
|
|
521
|
+
EventHelper.stop(e, true);
|
|
522
|
+
this.show();
|
|
523
|
+
}
|
|
524
|
+
}));
|
|
525
|
+
}
|
|
526
|
+
show(anchor) {
|
|
527
|
+
const anchorElement = anchor ?? this._domNode;
|
|
528
|
+
if (!anchorElement) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const previousModel = this._selectedModel;
|
|
532
|
+
const onSelect = model => {
|
|
533
|
+
this._telemetryService.publicLog2("chat.modelChange", {
|
|
534
|
+
fromModel: previousModel?.metadata.vendor === "copilot" ? ( new TelemetryTrustedValue(previousModel.identifier)) : "unknown",
|
|
535
|
+
toModel: model.metadata.vendor === "copilot" ? ( new TelemetryTrustedValue(model.identifier)) : "unknown"
|
|
536
|
+
});
|
|
537
|
+
this._selectedModel = model;
|
|
538
|
+
this._renderLabel();
|
|
539
|
+
this._onDidChangeSelection.fire(model);
|
|
540
|
+
};
|
|
541
|
+
const models = this._delegate.getModels();
|
|
542
|
+
const isPro = isProUser(this._entitlementService.entitlement);
|
|
543
|
+
const manifest = this._languageModelsService.getModelsControlManifest();
|
|
544
|
+
const controlModelsForTier = isPro ? manifest.paid : manifest.free;
|
|
545
|
+
const items = buildModelPickerItems(
|
|
546
|
+
models,
|
|
547
|
+
this._selectedModel?.identifier,
|
|
548
|
+
this._languageModelsService.getRecentlyUsedModelIds(),
|
|
549
|
+
controlModelsForTier,
|
|
550
|
+
this._productService.version,
|
|
551
|
+
this._updateService.state.type,
|
|
552
|
+
onSelect,
|
|
553
|
+
this._productService.defaultChatAgent?.manageSettingsUrl,
|
|
554
|
+
this._delegate.canManageModels(),
|
|
555
|
+
this._commandService,
|
|
556
|
+
this._entitlementService
|
|
557
|
+
);
|
|
558
|
+
const listOptions = {
|
|
559
|
+
showFilter: models.length >= 10,
|
|
560
|
+
filterPlaceholder: ( localize(6714, "Search models")),
|
|
561
|
+
focusFilterOnOpen: true,
|
|
562
|
+
collapsedByDefault: ( new Set([ModelPickerSection.Other])),
|
|
563
|
+
minWidth: 300
|
|
564
|
+
};
|
|
565
|
+
const previouslyFocusedElement = getActiveElement();
|
|
566
|
+
const delegate = {
|
|
567
|
+
onSelect: action => {
|
|
568
|
+
this._actionWidgetService.hide();
|
|
569
|
+
action.run();
|
|
570
|
+
},
|
|
571
|
+
onHide: () => {
|
|
572
|
+
this._domNode?.setAttribute("aria-expanded", "false");
|
|
573
|
+
if (isHTMLElement(previouslyFocusedElement)) {
|
|
574
|
+
previouslyFocusedElement.focus();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
this._domNode?.setAttribute("aria-expanded", "true");
|
|
579
|
+
this._actionWidgetService.show(
|
|
580
|
+
"ChatModelPicker",
|
|
581
|
+
false,
|
|
582
|
+
items,
|
|
583
|
+
delegate,
|
|
584
|
+
anchorElement,
|
|
585
|
+
undefined,
|
|
586
|
+
[],
|
|
587
|
+
getModelPickerAccessibilityProvider(),
|
|
588
|
+
listOptions
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
_updateBadge() {
|
|
592
|
+
if (this._badgeIcon) {
|
|
593
|
+
if (this._badge) {
|
|
594
|
+
const icon = this._badge === "info" ? Codicon.info : Codicon.warning;
|
|
595
|
+
reset(this._badgeIcon, renderIcon(icon));
|
|
596
|
+
this._badgeIcon.style.display = "";
|
|
597
|
+
this._badgeIcon.classList.toggle("info", this._badge === "info");
|
|
598
|
+
this._badgeIcon.classList.toggle("warning", this._badge === "warning");
|
|
599
|
+
} else {
|
|
600
|
+
this._badgeIcon.style.display = "none";
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
_renderLabel() {
|
|
605
|
+
if (!this._domNode) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const {
|
|
609
|
+
name,
|
|
610
|
+
statusIcon
|
|
611
|
+
} = this._selectedModel?.metadata || {};
|
|
612
|
+
const domChildren = [];
|
|
613
|
+
if (statusIcon) {
|
|
614
|
+
const iconElement = renderIcon(statusIcon);
|
|
615
|
+
domChildren.push(iconElement);
|
|
616
|
+
}
|
|
617
|
+
domChildren.push($("span.chat-input-picker-label", undefined, name ?? ( localize(6704, "Auto"))));
|
|
618
|
+
if (this._badgeIcon) {
|
|
619
|
+
domChildren.push(this._badgeIcon);
|
|
620
|
+
}
|
|
621
|
+
domChildren.push(...renderLabelWithIcons(`$(chevron-down)`));
|
|
622
|
+
reset(this._domNode, ...domChildren);
|
|
623
|
+
const modelName = this._selectedModel?.metadata.name ?? ( localize(6704, "Auto"));
|
|
624
|
+
this._domNode.ariaLabel = ( localize(6715, "Pick Model, {0}", modelName));
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
ModelPickerWidget = ( __decorate([( __param(1, IActionWidgetService)), ( __param(2, ICommandService)), ( __param(3, ITelemetryService)), ( __param(4, ILanguageModelsService)), ( __param(5, IProductService)), ( __param(6, IChatEntitlementService)), ( __param(7, IUpdateService))], ModelPickerWidget));
|
|
628
|
+
function getModelHoverContent(model) {
|
|
629
|
+
const isAuto = model.metadata.id === "auto" && model.metadata.vendor === "copilot";
|
|
630
|
+
const markdown = ( new MarkdownString("", {
|
|
631
|
+
isTrusted: true,
|
|
632
|
+
supportThemeIcons: true
|
|
633
|
+
}));
|
|
634
|
+
markdown.appendMarkdown(`**${model.metadata.name}**`);
|
|
635
|
+
markdown.appendText(`\n`);
|
|
636
|
+
if (model.metadata.statusIcon && model.metadata.tooltip) {
|
|
637
|
+
if (model.metadata.statusIcon) {
|
|
638
|
+
markdown.appendMarkdown(`$(${model.metadata.statusIcon.id}) `);
|
|
639
|
+
}
|
|
640
|
+
markdown.appendMarkdown(`${model.metadata.tooltip}`);
|
|
641
|
+
markdown.appendText(`\n`);
|
|
642
|
+
}
|
|
643
|
+
if (model.metadata.multiplier) {
|
|
644
|
+
markdown.appendMarkdown(`${( localize(
|
|
645
|
+
6716,
|
|
646
|
+
"Each chat message counts {0} toward your premium request quota",
|
|
647
|
+
model.metadata.multiplier
|
|
648
|
+
))}`);
|
|
649
|
+
markdown.appendText(`\n`);
|
|
650
|
+
}
|
|
651
|
+
if (!isAuto && (model.metadata.maxInputTokens || model.metadata.maxOutputTokens)) {
|
|
652
|
+
const totalTokens = (model.metadata.maxInputTokens ?? 0) + (model.metadata.maxOutputTokens ?? 0);
|
|
653
|
+
markdown.appendMarkdown(`${( localize(6717, "Context Size"))}: `);
|
|
654
|
+
markdown.appendMarkdown(`${formatTokenCount(totalTokens)}`);
|
|
655
|
+
markdown.appendText(`\n`);
|
|
656
|
+
}
|
|
657
|
+
return markdown;
|
|
658
|
+
}
|
|
659
|
+
function formatTokenCount(count) {
|
|
660
|
+
if (count >= 1000000) {
|
|
661
|
+
return `${(count / 1000000).toFixed(1)}M`;
|
|
662
|
+
} else if (count >= 1000) {
|
|
663
|
+
return `${(count / 1000).toFixed(0)}K`;
|
|
664
|
+
}
|
|
665
|
+
return ( count.toString());
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
export { ModelPickerWidget, buildModelPickerItems, getModelPickerAccessibilityProvider };
|