@codingame/monaco-vscode-chat-service-override 4.5.2 → 5.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/chat.js +6 -6
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +32 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +52 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +35 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +83 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +23 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +3 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatContributionServiceImpl.js → chatParticipantContributions.js} +43 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +33 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +48 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +76 -122
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +131 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +7 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChat.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +1 -4
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
3
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
|
-
import { DisposableStore, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { DisposableStore, DisposableMap, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
6
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
7
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
9
8
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
@@ -11,64 +10,19 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
|
11
10
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
12
11
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
13
12
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
14
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
15
13
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
|
|
16
|
-
import {
|
|
17
|
-
import { getNewChatAction } from './actions/chatClearActions.js';
|
|
18
|
-
import { getMoveToEditorAction, getMoveToNewWindowAction } from './actions/chatMoveActions.js';
|
|
19
|
-
import { getQuickChatActionForProvider } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
|
|
14
|
+
import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
20
15
|
import { ChatViewPane, CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
|
|
21
16
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
22
17
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
23
|
-
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService.service';
|
|
24
18
|
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
25
19
|
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
26
20
|
|
|
27
|
-
const _moduleId = "vs/workbench/contrib/chat/browser/
|
|
28
|
-
const chatExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
29
|
-
extensionPoint: 'interactiveSession',
|
|
30
|
-
jsonSchema: {
|
|
31
|
-
description: ( localizeWithPath(_moduleId, 0, 'Contributes an Interactive Session provider')),
|
|
32
|
-
type: 'array',
|
|
33
|
-
items: {
|
|
34
|
-
additionalProperties: false,
|
|
35
|
-
type: 'object',
|
|
36
|
-
defaultSnippets: [{ body: { id: '', program: '', runtime: '' } }],
|
|
37
|
-
required: ['id', 'label'],
|
|
38
|
-
properties: {
|
|
39
|
-
id: {
|
|
40
|
-
description: ( localizeWithPath(_moduleId, 1, "Unique identifier for this Interactive Session provider.")),
|
|
41
|
-
type: 'string'
|
|
42
|
-
},
|
|
43
|
-
label: {
|
|
44
|
-
description: ( localizeWithPath(_moduleId, 2, "Display name for this Interactive Session provider.")),
|
|
45
|
-
type: 'string'
|
|
46
|
-
},
|
|
47
|
-
icon: {
|
|
48
|
-
description: ( localizeWithPath(_moduleId, 3, "An icon for this Interactive Session provider.")),
|
|
49
|
-
type: 'string'
|
|
50
|
-
},
|
|
51
|
-
when: {
|
|
52
|
-
description: ( localizeWithPath(
|
|
53
|
-
_moduleId,
|
|
54
|
-
4,
|
|
55
|
-
"A condition which must be true to enable this Interactive Session provider."
|
|
56
|
-
)),
|
|
57
|
-
type: 'string'
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
activationEventsGenerator: (contributions, result) => {
|
|
63
|
-
for (const contrib of contributions) {
|
|
64
|
-
result.push(`onInteractiveSession:${contrib.id}`);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
});
|
|
21
|
+
const _moduleId = "vs/workbench/contrib/chat/browser/chatParticipantContributions";
|
|
68
22
|
const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
69
23
|
extensionPoint: 'chatParticipants',
|
|
70
24
|
jsonSchema: {
|
|
71
|
-
description: ( localizeWithPath(_moduleId,
|
|
25
|
+
description: ( localizeWithPath(_moduleId, 0, 'Contributes a chat participant')),
|
|
72
26
|
type: 'array',
|
|
73
27
|
items: {
|
|
74
28
|
additionalProperties: false,
|
|
@@ -77,25 +31,25 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
77
31
|
required: ['name', 'id'],
|
|
78
32
|
properties: {
|
|
79
33
|
id: {
|
|
80
|
-
description: ( localizeWithPath(_moduleId,
|
|
34
|
+
description: ( localizeWithPath(_moduleId, 1, "A unique id for this chat participant.")),
|
|
81
35
|
type: 'string'
|
|
82
36
|
},
|
|
83
37
|
name: {
|
|
84
38
|
description: ( localizeWithPath(
|
|
85
39
|
_moduleId,
|
|
86
|
-
|
|
40
|
+
2,
|
|
87
41
|
"User-facing display name for this chat participant. The user will use '@' with this name to invoke the participant."
|
|
88
42
|
)),
|
|
89
43
|
type: 'string'
|
|
90
44
|
},
|
|
91
45
|
description: {
|
|
92
|
-
description: ( localizeWithPath(_moduleId,
|
|
46
|
+
description: ( localizeWithPath(_moduleId, 3, "A description of this chat participant, shown in the UI.")),
|
|
93
47
|
type: 'string'
|
|
94
48
|
},
|
|
95
49
|
isDefault: {
|
|
96
50
|
markdownDescription: ( localizeWithPath(
|
|
97
51
|
_moduleId,
|
|
98
|
-
|
|
52
|
+
4,
|
|
99
53
|
"**Only** allowed for extensions that have the `defaultChatParticipant` proposal."
|
|
100
54
|
)),
|
|
101
55
|
type: 'boolean',
|
|
@@ -103,7 +57,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
103
57
|
isSticky: {
|
|
104
58
|
description: ( localizeWithPath(
|
|
105
59
|
_moduleId,
|
|
106
|
-
|
|
60
|
+
5,
|
|
107
61
|
"Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
|
|
108
62
|
)),
|
|
109
63
|
type: 'boolean'
|
|
@@ -118,7 +72,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
118
72
|
commands: {
|
|
119
73
|
markdownDescription: ( localizeWithPath(
|
|
120
74
|
_moduleId,
|
|
121
|
-
|
|
75
|
+
6,
|
|
122
76
|
"Commands available for this chat participant, which the user can invoke with a `/`."
|
|
123
77
|
)),
|
|
124
78
|
type: 'array',
|
|
@@ -131,23 +85,23 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
131
85
|
name: {
|
|
132
86
|
description: ( localizeWithPath(
|
|
133
87
|
_moduleId,
|
|
134
|
-
|
|
88
|
+
7,
|
|
135
89
|
"A short name by which this command is referred to in the UI, e.g. `fix` or * `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
|
|
136
90
|
)),
|
|
137
91
|
type: 'string'
|
|
138
92
|
},
|
|
139
93
|
description: {
|
|
140
|
-
description: ( localizeWithPath(_moduleId,
|
|
94
|
+
description: ( localizeWithPath(_moduleId, 8, "A description of this command.")),
|
|
141
95
|
type: 'string'
|
|
142
96
|
},
|
|
143
97
|
when: {
|
|
144
|
-
description: ( localizeWithPath(_moduleId,
|
|
98
|
+
description: ( localizeWithPath(_moduleId, 9, "A condition which must be true to enable this command.")),
|
|
145
99
|
type: 'string'
|
|
146
100
|
},
|
|
147
101
|
sampleRequest: {
|
|
148
102
|
description: ( localizeWithPath(
|
|
149
103
|
_moduleId,
|
|
150
|
-
|
|
104
|
+
10,
|
|
151
105
|
"When the user clicks this command in `/help`, this text will be submitted to this participant."
|
|
152
106
|
)),
|
|
153
107
|
type: 'string'
|
|
@@ -155,7 +109,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
155
109
|
isSticky: {
|
|
156
110
|
description: ( localizeWithPath(
|
|
157
111
|
_moduleId,
|
|
158
|
-
|
|
112
|
+
5,
|
|
159
113
|
"Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
|
|
160
114
|
)),
|
|
161
115
|
type: 'boolean'
|
|
@@ -163,7 +117,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
163
117
|
defaultImplicitVariables: {
|
|
164
118
|
markdownDescription: ( localizeWithPath(
|
|
165
119
|
_moduleId,
|
|
166
|
-
|
|
120
|
+
11,
|
|
167
121
|
"**Only** allowed for extensions that have the `chatParticipantAdditions` proposal. The names of the variables that are invoked by default"
|
|
168
122
|
)),
|
|
169
123
|
type: 'array',
|
|
@@ -175,7 +129,7 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
175
129
|
}
|
|
176
130
|
},
|
|
177
131
|
locations: {
|
|
178
|
-
markdownDescription: ( localizeWithPath(_moduleId,
|
|
132
|
+
markdownDescription: ( localizeWithPath(_moduleId, 12, "Locations in which this chat participant is available.")),
|
|
179
133
|
type: 'array',
|
|
180
134
|
default: ['panel'],
|
|
181
135
|
items: {
|
|
@@ -194,14 +148,12 @@ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
194
148
|
});
|
|
195
149
|
let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
196
150
|
static { this.ID = 'workbench.contrib.chatExtensionPointHandler'; }
|
|
197
|
-
constructor(
|
|
198
|
-
this._chatContributionService = _chatContributionService;
|
|
151
|
+
constructor(_chatAgentService, productService, contextService, logService) {
|
|
199
152
|
this._chatAgentService = _chatAgentService;
|
|
200
153
|
this.productService = productService;
|
|
201
154
|
this.contextService = contextService;
|
|
202
155
|
this.logService = logService;
|
|
203
156
|
this.disposables = ( (new DisposableStore()));
|
|
204
|
-
this._registrationDisposables = ( (new Map()));
|
|
205
157
|
this._participantRegistrationDisposables = ( (new DisposableMap()));
|
|
206
158
|
this._viewContainer = this.registerViewContainer();
|
|
207
159
|
this.registerListeners();
|
|
@@ -218,21 +170,17 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
218
170
|
const contextKeyExpr = ( (ContextKeyExpr.equals(showWelcomeViewConfigKey, true)));
|
|
219
171
|
const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
|
|
220
172
|
if (this.contextService.contextMatchesRules(contextKeyExpr)) {
|
|
221
|
-
const viewId = this._chatContributionService.getViewIdForProvider(this.productService.chatWelcomeView.welcomeViewId);
|
|
222
173
|
this._welcomeViewDescriptor = {
|
|
223
|
-
id:
|
|
174
|
+
id: CHAT_VIEW_ID,
|
|
224
175
|
name: { original: this.productService.chatWelcomeView.welcomeViewTitle, value: this.productService.chatWelcomeView.welcomeViewTitle },
|
|
225
176
|
containerIcon: this._viewContainer.icon,
|
|
226
|
-
ctorDescriptor: ( (new SyncDescriptor(
|
|
227
|
-
ChatViewPane,
|
|
228
|
-
[{ providerId: this.productService.chatWelcomeView.welcomeViewId }]
|
|
229
|
-
))),
|
|
177
|
+
ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
|
|
230
178
|
canToggleVisibility: false,
|
|
231
179
|
canMoveView: true,
|
|
232
180
|
order: 100
|
|
233
181
|
};
|
|
234
182
|
viewsRegistry.registerViews([this._welcomeViewDescriptor], this._viewContainer);
|
|
235
|
-
viewsRegistry.registerViewWelcomeContent(
|
|
183
|
+
viewsRegistry.registerViewWelcomeContent(CHAT_VIEW_ID, {
|
|
236
184
|
content: this.productService.chatWelcomeView.welcomeViewContent,
|
|
237
185
|
});
|
|
238
186
|
}
|
|
@@ -243,26 +191,6 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
243
191
|
}, null, this.disposables);
|
|
244
192
|
}
|
|
245
193
|
handleAndRegisterChatExtensions() {
|
|
246
|
-
chatExtensionPoint.setHandler((extensions, delta) => {
|
|
247
|
-
for (const extension of delta.added) {
|
|
248
|
-
const extensionDisposable = ( (new DisposableStore()));
|
|
249
|
-
for (const providerDescriptor of extension.value) {
|
|
250
|
-
this.registerChatProvider(providerDescriptor);
|
|
251
|
-
this._chatContributionService.registerChatProvider(providerDescriptor);
|
|
252
|
-
}
|
|
253
|
-
this._registrationDisposables.set(extension.description.identifier.value, extensionDisposable);
|
|
254
|
-
}
|
|
255
|
-
for (const extension of delta.removed) {
|
|
256
|
-
const registration = this._registrationDisposables.get(extension.description.identifier.value);
|
|
257
|
-
if (registration) {
|
|
258
|
-
registration.dispose();
|
|
259
|
-
this._registrationDisposables.delete(extension.description.identifier.value);
|
|
260
|
-
}
|
|
261
|
-
for (const providerDescriptor of extension.value) {
|
|
262
|
-
this._chatContributionService.deregisterChatProvider(providerDescriptor.id);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
194
|
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
|
|
267
195
|
for (const extension of delta.added) {
|
|
268
196
|
for (const providerDescriptor of extension.value) {
|
|
@@ -278,8 +206,15 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
278
206
|
this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant without both id and name.`);
|
|
279
207
|
continue;
|
|
280
208
|
}
|
|
281
|
-
|
|
209
|
+
const store = ( (new DisposableStore()));
|
|
210
|
+
if (providerDescriptor.isDefault && (!providerDescriptor.locations || providerDescriptor.locations?.includes(ChatAgentLocation.Panel))) {
|
|
211
|
+
store.add(this.registerDefaultParticipantView(providerDescriptor));
|
|
212
|
+
}
|
|
213
|
+
store.add(this._chatAgentService.registerAgent(providerDescriptor.id, {
|
|
282
214
|
extensionId: extension.description.identifier,
|
|
215
|
+
extensionPublisherDisplayName: extension.description.publisherDisplayName ?? extension.description.publisher,
|
|
216
|
+
extensionPublisherId: extension.description.publisher,
|
|
217
|
+
extensionDisplayName: extension.description.displayName ?? extension.description.name,
|
|
283
218
|
id: providerDescriptor.id,
|
|
284
219
|
description: providerDescriptor.description,
|
|
285
220
|
metadata: {
|
|
@@ -293,6 +228,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
293
228
|
[ChatAgentLocation.Panel],
|
|
294
229
|
slashCommands: providerDescriptor.commands ?? []
|
|
295
230
|
}));
|
|
231
|
+
this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.id), store);
|
|
296
232
|
}
|
|
297
233
|
}
|
|
298
234
|
for (const extension of delta.removed) {
|
|
@@ -303,7 +239,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
303
239
|
});
|
|
304
240
|
}
|
|
305
241
|
registerViewContainer() {
|
|
306
|
-
const title = ( localize2WithPath(_moduleId,
|
|
242
|
+
const title = ( localize2WithPath(_moduleId, 13, "Chat"));
|
|
307
243
|
const icon = Codicon.commentDiscussion;
|
|
308
244
|
const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
|
|
309
245
|
const viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
|
|
@@ -320,63 +256,31 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
|
320
256
|
}, 0 );
|
|
321
257
|
return viewContainer;
|
|
322
258
|
}
|
|
323
|
-
|
|
324
|
-
const viewId = this._chatContributionService.getViewIdForProvider(providerDescriptor.id);
|
|
259
|
+
registerDefaultParticipantView(defaultParticipantDescriptor) {
|
|
325
260
|
const viewDescriptor = [{
|
|
326
|
-
id:
|
|
261
|
+
id: CHAT_VIEW_ID,
|
|
327
262
|
containerIcon: this._viewContainer.icon,
|
|
328
263
|
containerTitle: this._viewContainer.title.value,
|
|
329
264
|
singleViewPaneContainerTitle: this._viewContainer.title.value,
|
|
330
|
-
name: { value:
|
|
265
|
+
name: { value: defaultParticipantDescriptor.name, original: defaultParticipantDescriptor.name },
|
|
331
266
|
canToggleVisibility: false,
|
|
332
267
|
canMoveView: true,
|
|
333
|
-
ctorDescriptor: ( (new SyncDescriptor(ChatViewPane
|
|
334
|
-
when: ContextKeyExpr.deserialize(providerDescriptor.when)
|
|
268
|
+
ctorDescriptor: ( (new SyncDescriptor(ChatViewPane))),
|
|
335
269
|
}];
|
|
336
270
|
( (Registry.as(Extensions.ViewsRegistry))).registerViews(viewDescriptor, this._viewContainer);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
disposables.add(registerAction2(getMoveToEditorAction(viewId, providerDescriptor.id)));
|
|
341
|
-
disposables.add(registerAction2(getMoveToNewWindowAction(viewId, providerDescriptor.id)));
|
|
342
|
-
disposables.add(registerAction2(getOpenChatEditorAction(providerDescriptor.id, providerDescriptor.label, providerDescriptor.when)));
|
|
343
|
-
disposables.add(registerAction2(getQuickChatActionForProvider(providerDescriptor.id, providerDescriptor.label)));
|
|
344
|
-
return {
|
|
345
|
-
dispose: () => {
|
|
346
|
-
( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, this._viewContainer);
|
|
347
|
-
( (Registry.as(Extensions.ViewContainersRegistry))).deregisterViewContainer(this._viewContainer);
|
|
348
|
-
disposables.dispose();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
271
|
+
return toDisposable(() => {
|
|
272
|
+
( (Registry.as(Extensions.ViewsRegistry))).deregisterViews(viewDescriptor, this._viewContainer);
|
|
273
|
+
});
|
|
351
274
|
}
|
|
352
275
|
};
|
|
353
276
|
ChatExtensionPointHandler = ( (__decorate([
|
|
354
|
-
( (__param(0,
|
|
355
|
-
( (__param(1,
|
|
356
|
-
( (__param(2,
|
|
357
|
-
( (__param(3,
|
|
358
|
-
( (__param(4, ILogService)))
|
|
277
|
+
( (__param(0, IChatAgentService))),
|
|
278
|
+
( (__param(1, IProductService))),
|
|
279
|
+
( (__param(2, IContextKeyService))),
|
|
280
|
+
( (__param(3, ILogService)))
|
|
359
281
|
], ChatExtensionPointHandler)));
|
|
360
|
-
registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, 1 );
|
|
361
282
|
function getParticipantKey(extensionId, participantName) {
|
|
362
283
|
return `${extensionId.value}_${participantName}`;
|
|
363
284
|
}
|
|
364
|
-
class ChatContributionService {
|
|
365
|
-
constructor() {
|
|
366
|
-
this._registeredProviders = ( (new Map()));
|
|
367
|
-
}
|
|
368
|
-
getViewIdForProvider(providerId) {
|
|
369
|
-
return ChatViewPane.ID + '.' + providerId;
|
|
370
|
-
}
|
|
371
|
-
registerChatProvider(provider) {
|
|
372
|
-
this._registeredProviders.set(provider.id, provider);
|
|
373
|
-
}
|
|
374
|
-
deregisterChatProvider(providerId) {
|
|
375
|
-
this._registeredProviders.delete(providerId);
|
|
376
|
-
}
|
|
377
|
-
get registeredProviders() {
|
|
378
|
-
return Array.from(( (this._registeredProviders.values())));
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
285
|
|
|
382
|
-
export {
|
|
286
|
+
export { ChatExtensionPointHandler };
|
|
@@ -22,10 +22,11 @@ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
|
22
22
|
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
23
23
|
import { quickInputForeground, quickInputBackground } from 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
24
24
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
25
|
-
import {
|
|
25
|
+
import { showChatView } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
26
26
|
import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
27
27
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
28
28
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
29
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
29
30
|
|
|
30
31
|
var QuickChat_1;
|
|
31
32
|
let QuickChatService = class QuickChatService extends Disposable {
|
|
@@ -38,7 +39,7 @@ let QuickChatService = class QuickChatService extends Disposable {
|
|
|
38
39
|
this.onDidClose = this._onDidClose.event;
|
|
39
40
|
}
|
|
40
41
|
get enabled() {
|
|
41
|
-
return this.chatService.
|
|
42
|
+
return !!this.chatService.isEnabled(ChatAgentLocation.Panel);
|
|
42
43
|
}
|
|
43
44
|
get focused() {
|
|
44
45
|
const widget = this._input?.widget;
|
|
@@ -47,12 +48,12 @@ let QuickChatService = class QuickChatService extends Disposable {
|
|
|
47
48
|
}
|
|
48
49
|
return isAncestorOfActiveElement(widget);
|
|
49
50
|
}
|
|
50
|
-
toggle(
|
|
51
|
+
toggle(options) {
|
|
51
52
|
if (this.focused && !options?.query) {
|
|
52
53
|
this.close();
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
|
-
this.open(
|
|
56
|
+
this.open(options);
|
|
56
57
|
if (options?.isPartialQuery) {
|
|
57
58
|
const disposable = this._store.add(Event.once(this.onDidClose)(() => {
|
|
58
59
|
this._currentChat?.clearValue();
|
|
@@ -61,7 +62,7 @@ let QuickChatService = class QuickChatService extends Disposable {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
open(
|
|
65
|
+
open(options) {
|
|
65
66
|
if (this._input) {
|
|
66
67
|
if (this._currentChat && options?.query) {
|
|
67
68
|
this._currentChat.focus();
|
|
@@ -73,12 +74,6 @@ let QuickChatService = class QuickChatService extends Disposable {
|
|
|
73
74
|
}
|
|
74
75
|
return this.focus();
|
|
75
76
|
}
|
|
76
|
-
const providerInfo = providerId
|
|
77
|
-
? this.chatService.getProviderInfos().find(info => info.id === providerId)
|
|
78
|
-
: this.chatService.getProviderInfos()[0];
|
|
79
|
-
if (!providerInfo) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
77
|
const disposableStore = ( new DisposableStore());
|
|
83
78
|
this._input = this.quickInputService.createQuickWidget();
|
|
84
79
|
this._input.contextKey = 'chatInputVisible';
|
|
@@ -88,9 +83,7 @@ let QuickChatService = class QuickChatService extends Disposable {
|
|
|
88
83
|
this._input.widget = this._container;
|
|
89
84
|
this._input.show();
|
|
90
85
|
if (!this._currentChat) {
|
|
91
|
-
this._currentChat = this.instantiationService.createInstance(QuickChat
|
|
92
|
-
providerId: providerInfo.id,
|
|
93
|
-
});
|
|
86
|
+
this._currentChat = this.instantiationService.createInstance(QuickChat);
|
|
94
87
|
this._currentChat.render(this._container);
|
|
95
88
|
}
|
|
96
89
|
else {
|
|
@@ -131,14 +124,13 @@ let QuickChat = class QuickChat extends Disposable {
|
|
|
131
124
|
static { QuickChat_1 = this; }
|
|
132
125
|
static { this.DEFAULT_MIN_HEIGHT = 200; }
|
|
133
126
|
static { this.DEFAULT_HEIGHT_OFFSET = 100; }
|
|
134
|
-
constructor(
|
|
127
|
+
constructor(instantiationService, contextKeyService, chatService, layoutService, viewsService) {
|
|
135
128
|
super();
|
|
136
|
-
this._options = _options;
|
|
137
129
|
this.instantiationService = instantiationService;
|
|
138
130
|
this.contextKeyService = contextKeyService;
|
|
139
131
|
this.chatService = chatService;
|
|
140
|
-
this._chatWidgetService = _chatWidgetService;
|
|
141
132
|
this.layoutService = layoutService;
|
|
133
|
+
this.viewsService = viewsService;
|
|
142
134
|
this.maintainScrollTimer = this._register(( new MutableDisposable()));
|
|
143
135
|
this._deferUpdatingDynamicLayout = false;
|
|
144
136
|
}
|
|
@@ -240,14 +232,29 @@ let QuickChat = class QuickChat extends Disposable {
|
|
|
240
232
|
return this.widget.acceptInput();
|
|
241
233
|
}
|
|
242
234
|
async openChatView() {
|
|
243
|
-
const widget = await
|
|
235
|
+
const widget = await showChatView(this.viewsService);
|
|
244
236
|
if (!widget?.viewModel || !this.model) {
|
|
245
237
|
return;
|
|
246
238
|
}
|
|
247
239
|
for (const request of this.model.getRequests()) {
|
|
248
240
|
if (request.response?.response.value || request.response?.result) {
|
|
249
|
-
|
|
250
|
-
|
|
241
|
+
const message = [];
|
|
242
|
+
for (const item of request.response.response.value) {
|
|
243
|
+
if (item.kind === 'textEditGroup') {
|
|
244
|
+
for (const group of item.edits) {
|
|
245
|
+
message.push({
|
|
246
|
+
kind: 'textEdit',
|
|
247
|
+
edits: group,
|
|
248
|
+
uri: item.uri
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
message.push(item);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
this.chatService.addCompleteRequest(widget.viewModel.sessionId, request.message, request.variableData, request.attempt, {
|
|
257
|
+
message,
|
|
251
258
|
result: request.response.result,
|
|
252
259
|
followups: request.response.followups
|
|
253
260
|
});
|
|
@@ -267,7 +274,7 @@ let QuickChat = class QuickChat extends Disposable {
|
|
|
267
274
|
this.widget.inputEditor.setValue('');
|
|
268
275
|
}
|
|
269
276
|
updateModel() {
|
|
270
|
-
this.model ??= this.chatService.startSession(
|
|
277
|
+
this.model ??= this.chatService.startSession(ChatAgentLocation.Panel, CancellationToken.None);
|
|
271
278
|
if (!this.model) {
|
|
272
279
|
throw ( new Error('Could not start chat session'));
|
|
273
280
|
}
|
|
@@ -275,11 +282,11 @@ let QuickChat = class QuickChat extends Disposable {
|
|
|
275
282
|
}
|
|
276
283
|
};
|
|
277
284
|
QuickChat = QuickChat_1 = ( __decorate([
|
|
278
|
-
( __param(
|
|
279
|
-
( __param(
|
|
280
|
-
( __param(
|
|
281
|
-
( __param(
|
|
282
|
-
( __param(
|
|
285
|
+
( __param(0, IInstantiationService)),
|
|
286
|
+
( __param(1, IContextKeyService)),
|
|
287
|
+
( __param(2, IChatService)),
|
|
288
|
+
( __param(3, ILayoutService)),
|
|
289
|
+
( __param(4, IViewsService))
|
|
283
290
|
], QuickChat));
|
|
284
291
|
|
|
285
292
|
export { QuickChatService };
|