@codingame/monaco-vscode-chat-service-override 8.0.4 → 9.0.2
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/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +24 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +47 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +27 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +179 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +2 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatContextAttachments.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +37 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +253 -67
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.js +59 -18
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +51 -20
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +28 -49
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +130 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +10 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -258
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
|
-
import { KeyCode, KeyMod } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
3
|
-
import marked_1 from 'vscode/external/vscode-marked/lib/marked.esm.js';
|
|
4
|
-
import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
5
|
-
import { localize2 } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
-
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
-
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
9
|
-
import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
10
|
-
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
11
|
-
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
12
|
-
import { CONTEXT_RESPONSE_VOTE, CONTEXT_RESPONSE, CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE_FILTERED, CONTEXT_IN_CHAT_SESSION, CONTEXT_IN_CHAT_INPUT, CONTEXT_REQUEST } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
13
|
-
import { ChatAgentVoteDirection } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
14
|
-
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
15
|
-
import { isResponseVM, isRequestVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
16
|
-
import { NOTEBOOK_EDITOR_ID, CellEditType, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
17
|
-
import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
18
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
19
|
-
|
|
20
|
-
function registerChatTitleActions() {
|
|
21
|
-
registerAction2(class MarkHelpfulAction extends Action2 {
|
|
22
|
-
constructor() {
|
|
23
|
-
super({
|
|
24
|
-
id: 'workbench.action.chat.markHelpful',
|
|
25
|
-
title: ( localize2(7132, "Helpful")),
|
|
26
|
-
f1: false,
|
|
27
|
-
category: CHAT_CATEGORY,
|
|
28
|
-
icon: Codicon.thumbsup,
|
|
29
|
-
toggled: ( (CONTEXT_RESPONSE_VOTE.isEqualTo('up'))),
|
|
30
|
-
menu: {
|
|
31
|
-
id: MenuId.ChatMessageTitle,
|
|
32
|
-
group: 'navigation',
|
|
33
|
-
order: 1,
|
|
34
|
-
when: CONTEXT_RESPONSE
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
run(accessor, ...args) {
|
|
39
|
-
const item = args[0];
|
|
40
|
-
if (!isResponseVM(item)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const chatService = accessor.get(IChatService);
|
|
44
|
-
chatService.notifyUserAction({
|
|
45
|
-
agentId: item.agent?.id,
|
|
46
|
-
command: item.slashCommand?.name,
|
|
47
|
-
sessionId: item.sessionId,
|
|
48
|
-
requestId: item.requestId,
|
|
49
|
-
result: item.result,
|
|
50
|
-
action: {
|
|
51
|
-
kind: 'vote',
|
|
52
|
-
direction: ChatAgentVoteDirection.Up,
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
item.setVote(ChatAgentVoteDirection.Up);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
registerAction2(class MarkUnhelpfulAction extends Action2 {
|
|
59
|
-
constructor() {
|
|
60
|
-
super({
|
|
61
|
-
id: 'workbench.action.chat.markUnhelpful',
|
|
62
|
-
title: ( localize2(7133, "Unhelpful")),
|
|
63
|
-
f1: false,
|
|
64
|
-
category: CHAT_CATEGORY,
|
|
65
|
-
icon: Codicon.thumbsdown,
|
|
66
|
-
toggled: ( (CONTEXT_RESPONSE_VOTE.isEqualTo('down'))),
|
|
67
|
-
menu: {
|
|
68
|
-
id: MenuId.ChatMessageTitle,
|
|
69
|
-
group: 'navigation',
|
|
70
|
-
order: 2,
|
|
71
|
-
when: CONTEXT_RESPONSE
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
run(accessor, ...args) {
|
|
76
|
-
const item = args[0];
|
|
77
|
-
if (!isResponseVM(item)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const chatService = accessor.get(IChatService);
|
|
81
|
-
chatService.notifyUserAction({
|
|
82
|
-
agentId: item.agent?.id,
|
|
83
|
-
command: item.slashCommand?.name,
|
|
84
|
-
sessionId: item.sessionId,
|
|
85
|
-
requestId: item.requestId,
|
|
86
|
-
result: item.result,
|
|
87
|
-
action: {
|
|
88
|
-
kind: 'vote',
|
|
89
|
-
direction: ChatAgentVoteDirection.Down,
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
item.setVote(ChatAgentVoteDirection.Down);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
registerAction2(class ReportIssueForBugAction extends Action2 {
|
|
96
|
-
constructor() {
|
|
97
|
-
super({
|
|
98
|
-
id: 'workbench.action.chat.reportIssueForBug',
|
|
99
|
-
title: ( localize2(7134, "Report Issue")),
|
|
100
|
-
f1: false,
|
|
101
|
-
category: CHAT_CATEGORY,
|
|
102
|
-
icon: Codicon.report,
|
|
103
|
-
menu: {
|
|
104
|
-
id: MenuId.ChatMessageTitle,
|
|
105
|
-
group: 'navigation',
|
|
106
|
-
order: 3,
|
|
107
|
-
when: ( (ContextKeyExpr.and(CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE)))
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
run(accessor, ...args) {
|
|
112
|
-
const item = args[0];
|
|
113
|
-
if (!isResponseVM(item)) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const chatService = accessor.get(IChatService);
|
|
117
|
-
chatService.notifyUserAction({
|
|
118
|
-
agentId: item.agent?.id,
|
|
119
|
-
command: item.slashCommand?.name,
|
|
120
|
-
sessionId: item.sessionId,
|
|
121
|
-
requestId: item.requestId,
|
|
122
|
-
result: item.result,
|
|
123
|
-
action: {
|
|
124
|
-
kind: 'bug'
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
registerAction2(class InsertToNotebookAction extends Action2 {
|
|
130
|
-
constructor() {
|
|
131
|
-
super({
|
|
132
|
-
id: 'workbench.action.chat.insertIntoNotebook',
|
|
133
|
-
title: ( localize2(7135, "Insert into Notebook")),
|
|
134
|
-
f1: false,
|
|
135
|
-
category: CHAT_CATEGORY,
|
|
136
|
-
icon: Codicon.insert,
|
|
137
|
-
menu: {
|
|
138
|
-
id: MenuId.ChatMessageTitle,
|
|
139
|
-
group: 'navigation',
|
|
140
|
-
isHiddenByDefault: true,
|
|
141
|
-
when: ( (ContextKeyExpr.and(
|
|
142
|
-
NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
143
|
-
CONTEXT_RESPONSE,
|
|
144
|
-
(CONTEXT_RESPONSE_FILTERED.negate())
|
|
145
|
-
)))
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
async run(accessor, ...args) {
|
|
150
|
-
const item = args[0];
|
|
151
|
-
if (!isResponseVM(item)) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const editorService = accessor.get(IEditorService);
|
|
155
|
-
if (editorService.activeEditorPane?.getId() === NOTEBOOK_EDITOR_ID) {
|
|
156
|
-
const notebookEditor = editorService.activeEditorPane.getControl();
|
|
157
|
-
if (!notebookEditor.hasModel()) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (notebookEditor.isReadOnly) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const value = ( (item.response.toString()));
|
|
164
|
-
const splitContents = splitMarkdownAndCodeBlocks(value);
|
|
165
|
-
const focusRange = notebookEditor.getFocus();
|
|
166
|
-
const index = Math.max(focusRange.end, 0);
|
|
167
|
-
const bulkEditService = accessor.get(IBulkEditService);
|
|
168
|
-
await bulkEditService.apply([
|
|
169
|
-
( (new ResourceNotebookCellEdit(notebookEditor.textModel.uri, {
|
|
170
|
-
editType: CellEditType.Replace,
|
|
171
|
-
index: index,
|
|
172
|
-
count: 0,
|
|
173
|
-
cells: ( (splitContents.map(content => {
|
|
174
|
-
const kind = content.type === 'markdown' ? CellKind.Markup : CellKind.Code;
|
|
175
|
-
const language = content.type === 'markdown' ? 'markdown' : content.language;
|
|
176
|
-
const mime = content.type === 'markdown' ? 'text/markdown' : `text/x-${content.language}`;
|
|
177
|
-
return {
|
|
178
|
-
cellKind: kind,
|
|
179
|
-
language,
|
|
180
|
-
mime,
|
|
181
|
-
source: content.content,
|
|
182
|
-
outputs: [],
|
|
183
|
-
metadata: {}
|
|
184
|
-
};
|
|
185
|
-
})))
|
|
186
|
-
})))
|
|
187
|
-
], { quotableLabel: 'Insert into Notebook' });
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
registerAction2(class RemoveAction extends Action2 {
|
|
192
|
-
constructor() {
|
|
193
|
-
super({
|
|
194
|
-
id: 'workbench.action.chat.remove',
|
|
195
|
-
title: ( localize2(7136, "Remove Request and Response")),
|
|
196
|
-
f1: false,
|
|
197
|
-
category: CHAT_CATEGORY,
|
|
198
|
-
icon: Codicon.x,
|
|
199
|
-
keybinding: {
|
|
200
|
-
primary: KeyCode.Delete,
|
|
201
|
-
mac: {
|
|
202
|
-
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
|
|
203
|
-
},
|
|
204
|
-
when: ( (ContextKeyExpr.and(CONTEXT_IN_CHAT_SESSION, (CONTEXT_IN_CHAT_INPUT.negate())))),
|
|
205
|
-
weight: KeybindingWeight.WorkbenchContrib,
|
|
206
|
-
},
|
|
207
|
-
menu: {
|
|
208
|
-
id: MenuId.ChatMessageTitle,
|
|
209
|
-
group: 'navigation',
|
|
210
|
-
order: 2,
|
|
211
|
-
when: CONTEXT_REQUEST
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
run(accessor, ...args) {
|
|
216
|
-
let item = args[0];
|
|
217
|
-
if (!isRequestVM(item)) {
|
|
218
|
-
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
219
|
-
const widget = chatWidgetService.lastFocusedWidget;
|
|
220
|
-
item = widget?.getFocus();
|
|
221
|
-
}
|
|
222
|
-
const requestId = isRequestVM(item) ? item.id :
|
|
223
|
-
isResponseVM(item) ? item.requestId : undefined;
|
|
224
|
-
if (requestId) {
|
|
225
|
-
const chatService = accessor.get(IChatService);
|
|
226
|
-
chatService.removeRequest(item.sessionId, requestId);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function splitMarkdownAndCodeBlocks(markdown) {
|
|
232
|
-
const lexer = new marked_1.Lexer();
|
|
233
|
-
const tokens = lexer.lex(markdown);
|
|
234
|
-
const splitContent = [];
|
|
235
|
-
let markdownPart = '';
|
|
236
|
-
tokens.forEach((token) => {
|
|
237
|
-
if (token.type === 'code') {
|
|
238
|
-
if (markdownPart.trim()) {
|
|
239
|
-
splitContent.push({ type: 'markdown', content: markdownPart });
|
|
240
|
-
markdownPart = '';
|
|
241
|
-
}
|
|
242
|
-
splitContent.push({
|
|
243
|
-
type: 'code',
|
|
244
|
-
language: token.lang || '',
|
|
245
|
-
content: token.text,
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
markdownPart += token.raw;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
if (markdownPart.trim()) {
|
|
253
|
-
splitContent.push({ type: 'markdown', content: markdownPart });
|
|
254
|
-
}
|
|
255
|
-
return splitContent;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export { registerChatTitleActions };
|