@codingame/monaco-vscode-chat-service-override 4.5.1 → 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 +36 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +78 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +5 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +6 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +10 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +39 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +102 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +57 -70
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +3 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatContributionServiceImpl.js → chatParticipantContributions.js} +63 -202
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +35 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +49 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +71 -74
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +142 -185
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +3 -3
- 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 +11 -2
- 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
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -34
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
2
2
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
6
6
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
7
7
|
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
8
8
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
9
9
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
10
|
-
import {
|
|
10
|
+
import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
11
11
|
import { isExportableSessionData } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
12
12
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
13
13
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
14
14
|
|
|
15
|
+
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatImportExport";
|
|
15
16
|
const defaultFileName = 'chat.json';
|
|
16
|
-
const filters = [{ name: ( localizeWithPath(
|
|
17
|
-
'vs/workbench/contrib/chat/browser/actions/chatImportExport',
|
|
18
|
-
'chat.file.label',
|
|
19
|
-
"Chat Session"
|
|
20
|
-
)), extensions: ['json'] }];
|
|
17
|
+
const filters = [{ name: ( localizeWithPath(_moduleId, 0, "Chat Session")), extensions: ['json'] }];
|
|
21
18
|
function registerChatExportActions() {
|
|
22
19
|
registerAction2(class ExportChatAction extends Action2 {
|
|
23
20
|
constructor() {
|
|
24
21
|
super({
|
|
25
22
|
id: 'workbench.action.chat.export',
|
|
26
23
|
category: CHAT_CATEGORY,
|
|
27
|
-
title:
|
|
28
|
-
|
|
29
|
-
'vs/workbench/contrib/chat/browser/actions/chatImportExport',
|
|
30
|
-
'chat.export.label',
|
|
31
|
-
"Export Session"
|
|
32
|
-
)) + '...',
|
|
33
|
-
original: 'Export Session...'
|
|
34
|
-
},
|
|
35
|
-
precondition: CONTEXT_PROVIDER_EXISTS,
|
|
24
|
+
title: ( localize2WithPath(_moduleId, 1, "Export Chat...")),
|
|
25
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
36
26
|
f1: true,
|
|
37
27
|
});
|
|
38
28
|
}
|
|
@@ -65,16 +55,9 @@ function registerChatExportActions() {
|
|
|
65
55
|
constructor() {
|
|
66
56
|
super({
|
|
67
57
|
id: 'workbench.action.chat.import',
|
|
68
|
-
title:
|
|
69
|
-
value: ( localizeWithPath(
|
|
70
|
-
'vs/workbench/contrib/chat/browser/actions/chatImportExport',
|
|
71
|
-
'chat.import.label',
|
|
72
|
-
"Import Session"
|
|
73
|
-
)) + '...',
|
|
74
|
-
original: 'Import Session...'
|
|
75
|
-
},
|
|
58
|
+
title: ( localize2WithPath(_moduleId, 2, "Import Chat...")),
|
|
76
59
|
category: CHAT_CATEGORY,
|
|
77
|
-
precondition:
|
|
60
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
78
61
|
f1: true,
|
|
79
62
|
});
|
|
80
63
|
}
|
|
@@ -93,9 +76,9 @@ function registerChatExportActions() {
|
|
|
93
76
|
}
|
|
94
77
|
const content = await fileService.readFile(result[0]);
|
|
95
78
|
try {
|
|
96
|
-
const data = JSON.parse(( content.value.toString()));
|
|
79
|
+
const data = JSON.parse(( (content.value.toString())));
|
|
97
80
|
if (!isExportableSessionData(data)) {
|
|
98
|
-
throw new Error('Invalid chat session data');
|
|
81
|
+
throw ( (new Error('Invalid chat session data')));
|
|
99
82
|
}
|
|
100
83
|
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { data }, pinned: true } });
|
|
101
84
|
}
|
|
@@ -1,125 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
4
|
-
import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
5
4
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { CHAT_CATEGORY, isChatViewTitleActionContext } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
6
|
+
import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
8
7
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
9
8
|
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
10
|
-
import {
|
|
11
|
-
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService.service';
|
|
12
|
-
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
9
|
+
import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
13
10
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
14
11
|
import { AUX_WINDOW_GROUP, ACTIVE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
15
12
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
13
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
16
14
|
|
|
15
|
+
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatMoveActions";
|
|
17
16
|
var MoveToNewLocation;
|
|
18
|
-
( (function(MoveToNewLocation) {
|
|
17
|
+
( ((function(MoveToNewLocation) {
|
|
19
18
|
MoveToNewLocation["Editor"] = "Editor";
|
|
20
19
|
MoveToNewLocation["Window"] = "Window";
|
|
21
|
-
})(MoveToNewLocation || (MoveToNewLocation = {})));
|
|
22
|
-
const getMoveToChatActionDescriptorForViewTitle = (viewId, providerId, moveTo) => ({
|
|
23
|
-
id: `workbench.action.chat.${providerId}.openIn${moveTo}`,
|
|
24
|
-
title: {
|
|
25
|
-
value: moveTo === MoveToNewLocation.Editor ? ( localizeWithPath(
|
|
26
|
-
'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
|
|
27
|
-
'chat.openInEditor.label',
|
|
28
|
-
"Open Chat in Editor"
|
|
29
|
-
)) : ( localizeWithPath(
|
|
30
|
-
'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
|
|
31
|
-
'chat.openInNewWindow.label',
|
|
32
|
-
"Open Chat in New Window"
|
|
33
|
-
)),
|
|
34
|
-
original: moveTo === MoveToNewLocation.Editor ? 'Open Chat in Editor' : 'Open Chat in New Window',
|
|
35
|
-
},
|
|
36
|
-
category: CHAT_CATEGORY,
|
|
37
|
-
precondition: CONTEXT_PROVIDER_EXISTS,
|
|
38
|
-
f1: false,
|
|
39
|
-
viewId,
|
|
40
|
-
menu: {
|
|
41
|
-
id: MenuId.ViewTitle,
|
|
42
|
-
when: ( ContextKeyExpr.equals('view', viewId)),
|
|
43
|
-
order: 0
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
function getMoveToEditorAction(viewId, providerId) {
|
|
47
|
-
return getMoveToAction(viewId, providerId, MoveToNewLocation.Editor);
|
|
48
|
-
}
|
|
49
|
-
function getMoveToNewWindowAction(viewId, providerId) {
|
|
50
|
-
return getMoveToAction(viewId, providerId, MoveToNewLocation.Window);
|
|
51
|
-
}
|
|
52
|
-
function getMoveToAction(viewId, providerId, moveTo) {
|
|
53
|
-
return class MoveToAction extends ViewAction {
|
|
54
|
-
constructor() {
|
|
55
|
-
super(getMoveToChatActionDescriptorForViewTitle(viewId, providerId, moveTo));
|
|
56
|
-
}
|
|
57
|
-
async runInView(accessor, view) {
|
|
58
|
-
const viewModel = view.widget.viewModel;
|
|
59
|
-
if (!viewModel) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const editorService = accessor.get(IEditorService);
|
|
63
|
-
const sessionId = viewModel.sessionId;
|
|
64
|
-
const viewState = view.widget.getViewState();
|
|
65
|
-
view.clear();
|
|
66
|
-
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId }, pinned: true, viewState: viewState } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
20
|
+
})(MoveToNewLocation || (MoveToNewLocation = {}))));
|
|
70
21
|
function registerMoveActions() {
|
|
71
22
|
registerAction2(class GlobalMoveToEditorAction extends Action2 {
|
|
72
23
|
constructor() {
|
|
73
24
|
super({
|
|
74
25
|
id: `workbench.action.chat.openInEditor`,
|
|
75
|
-
title: ( localize2WithPath(
|
|
76
|
-
'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
|
|
77
|
-
'interactiveSession.openInEditor.label',
|
|
78
|
-
"Open Chat in Editor"
|
|
79
|
-
)),
|
|
26
|
+
title: ( localize2WithPath(_moduleId, 0, "Open Chat in Editor")),
|
|
80
27
|
category: CHAT_CATEGORY,
|
|
81
|
-
precondition:
|
|
82
|
-
f1: true
|
|
28
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
29
|
+
f1: true,
|
|
30
|
+
menu: {
|
|
31
|
+
id: MenuId.ViewTitle,
|
|
32
|
+
when: ( (ContextKeyExpr.equals('view', CHAT_VIEW_ID))),
|
|
33
|
+
order: 0
|
|
34
|
+
},
|
|
83
35
|
});
|
|
84
36
|
}
|
|
85
37
|
async run(accessor, ...args) {
|
|
86
|
-
|
|
38
|
+
const context = args[0];
|
|
39
|
+
executeMoveToAction(accessor, MoveToNewLocation.Editor, isChatViewTitleActionContext(context) ? context.chatView : undefined);
|
|
87
40
|
}
|
|
88
41
|
});
|
|
89
42
|
registerAction2(class GlobalMoveToNewWindowAction extends Action2 {
|
|
90
43
|
constructor() {
|
|
91
44
|
super({
|
|
92
45
|
id: `workbench.action.chat.openInNewWindow`,
|
|
93
|
-
title: ( localize2WithPath(
|
|
94
|
-
'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
|
|
95
|
-
'interactiveSession.openInNewWindow.label',
|
|
96
|
-
"Open Chat in New Window"
|
|
97
|
-
)),
|
|
46
|
+
title: ( localize2WithPath(_moduleId, 1, "Open Chat in New Window")),
|
|
98
47
|
category: CHAT_CATEGORY,
|
|
99
|
-
precondition:
|
|
100
|
-
f1: true
|
|
48
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
49
|
+
f1: true,
|
|
50
|
+
menu: {
|
|
51
|
+
id: MenuId.ViewTitle,
|
|
52
|
+
when: ( (ContextKeyExpr.equals('view', CHAT_VIEW_ID))),
|
|
53
|
+
order: 0
|
|
54
|
+
},
|
|
101
55
|
});
|
|
102
56
|
}
|
|
103
57
|
async run(accessor, ...args) {
|
|
104
|
-
|
|
58
|
+
const context = args[0];
|
|
59
|
+
executeMoveToAction(accessor, MoveToNewLocation.Window, isChatViewTitleActionContext(context) ? context.chatView : undefined);
|
|
105
60
|
}
|
|
106
61
|
});
|
|
107
62
|
registerAction2(class GlobalMoveToSidebarAction extends Action2 {
|
|
108
63
|
constructor() {
|
|
109
64
|
super({
|
|
110
65
|
id: `workbench.action.chat.openInSidebar`,
|
|
111
|
-
title: ( localize2WithPath(
|
|
112
|
-
'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
|
|
113
|
-
'interactiveSession.openInSidebar.label',
|
|
114
|
-
"Open Chat in Side Bar"
|
|
115
|
-
)),
|
|
66
|
+
title: ( localize2WithPath(_moduleId, 2, "Open Chat in Side Bar")),
|
|
116
67
|
category: CHAT_CATEGORY,
|
|
117
|
-
precondition:
|
|
68
|
+
precondition: CONTEXT_CHAT_ENABLED,
|
|
118
69
|
f1: true,
|
|
119
70
|
menu: [{
|
|
120
71
|
id: MenuId.EditorTitle,
|
|
121
72
|
order: 0,
|
|
122
|
-
when: ( ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID)),
|
|
73
|
+
when: ( (ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID))),
|
|
123
74
|
}]
|
|
124
75
|
});
|
|
125
76
|
}
|
|
@@ -128,15 +79,13 @@ function registerMoveActions() {
|
|
|
128
79
|
}
|
|
129
80
|
});
|
|
130
81
|
}
|
|
131
|
-
async function executeMoveToAction(accessor, moveTo) {
|
|
82
|
+
async function executeMoveToAction(accessor, moveTo, chatView) {
|
|
132
83
|
const widgetService = accessor.get(IChatWidgetService);
|
|
133
84
|
const viewService = accessor.get(IViewsService);
|
|
134
|
-
const chatService = accessor.get(IChatService);
|
|
135
85
|
const editorService = accessor.get(IEditorService);
|
|
136
|
-
const widget = widgetService.lastFocusedWidget;
|
|
86
|
+
const widget = chatView?.widget ?? widgetService.lastFocusedWidget;
|
|
137
87
|
if (!widget || !('viewId' in widget.viewContext)) {
|
|
138
|
-
|
|
139
|
-
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { providerId }, pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
88
|
+
await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
|
|
140
89
|
return;
|
|
141
90
|
}
|
|
142
91
|
const viewModel = widget.viewModel;
|
|
@@ -152,21 +101,16 @@ async function executeMoveToAction(accessor, moveTo) {
|
|
|
152
101
|
async function moveToSidebar(accessor) {
|
|
153
102
|
const viewsService = accessor.get(IViewsService);
|
|
154
103
|
const editorService = accessor.get(IEditorService);
|
|
155
|
-
const chatContribService = accessor.get(IChatContributionService);
|
|
156
104
|
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
157
105
|
const chatEditorInput = editorService.activeEditor;
|
|
158
|
-
if (chatEditorInput instanceof ChatEditorInput && chatEditorInput.sessionId
|
|
106
|
+
if (chatEditorInput instanceof ChatEditorInput && chatEditorInput.sessionId) {
|
|
159
107
|
await editorService.closeEditor({ editor: chatEditorInput, groupId: editorGroupService.activeGroup.id });
|
|
160
|
-
const
|
|
161
|
-
const view = await viewsService.openView(viewId);
|
|
108
|
+
const view = await viewsService.openView(CHAT_VIEW_ID);
|
|
162
109
|
view.loadSession(chatEditorInput.sessionId);
|
|
163
110
|
}
|
|
164
111
|
else {
|
|
165
|
-
|
|
166
|
-
const providerId = chatService.getProviderInfos()[0].id;
|
|
167
|
-
const viewId = chatContribService.getViewIdForProvider(providerId);
|
|
168
|
-
await viewsService.openView(viewId);
|
|
112
|
+
await viewsService.openView(CHAT_VIEW_ID);
|
|
169
113
|
}
|
|
170
114
|
}
|
|
171
115
|
|
|
172
|
-
export {
|
|
116
|
+
export { registerMoveActions };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
2
|
import marked_1 from 'vscode/external/vscode-marked/lib/marked.esm.js';
|
|
3
3
|
import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
4
|
-
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
5
|
-
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
5
|
+
import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
6
6
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
7
7
|
import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
8
8
|
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
9
9
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
10
|
-
import {
|
|
10
|
+
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
11
|
+
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, CONTEXT_CHAT_LOCATION, CONTEXT_RESPONSE_DETECTED_AGENT_COMMAND } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
11
12
|
import { InteractiveSessionVoteDirection } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
12
13
|
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
13
14
|
import { isResponseVM, isRequestVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
@@ -15,20 +16,17 @@ import { NOTEBOOK_EDITOR_ID, CellKind } from 'vscode/vscode/vs/workbench/contrib
|
|
|
15
16
|
import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
16
17
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
17
18
|
|
|
19
|
+
const _moduleId = "vs/workbench/contrib/chat/browser/actions/chatTitleActions";
|
|
18
20
|
function registerChatTitleActions() {
|
|
19
21
|
registerAction2(class MarkHelpfulAction extends Action2 {
|
|
20
22
|
constructor() {
|
|
21
23
|
super({
|
|
22
24
|
id: 'workbench.action.chat.markHelpful',
|
|
23
|
-
title: ( localize2WithPath(
|
|
24
|
-
'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
|
|
25
|
-
'interactive.helpful.label',
|
|
26
|
-
"Helpful"
|
|
27
|
-
)),
|
|
25
|
+
title: ( localize2WithPath(_moduleId, 0, "Helpful")),
|
|
28
26
|
f1: false,
|
|
29
27
|
category: CHAT_CATEGORY,
|
|
30
28
|
icon: Codicon.thumbsup,
|
|
31
|
-
toggled: ( CONTEXT_RESPONSE_VOTE.isEqualTo('up')),
|
|
29
|
+
toggled: ( (CONTEXT_RESPONSE_VOTE.isEqualTo('up'))),
|
|
32
30
|
menu: {
|
|
33
31
|
id: MenuId.ChatMessageTitle,
|
|
34
32
|
group: 'navigation',
|
|
@@ -44,7 +42,6 @@ function registerChatTitleActions() {
|
|
|
44
42
|
}
|
|
45
43
|
const chatService = accessor.get(IChatService);
|
|
46
44
|
chatService.notifyUserAction({
|
|
47
|
-
providerId: item.providerId,
|
|
48
45
|
agentId: item.agent?.id,
|
|
49
46
|
sessionId: item.sessionId,
|
|
50
47
|
requestId: item.requestId,
|
|
@@ -61,15 +58,11 @@ function registerChatTitleActions() {
|
|
|
61
58
|
constructor() {
|
|
62
59
|
super({
|
|
63
60
|
id: 'workbench.action.chat.markUnhelpful',
|
|
64
|
-
title: ( localize2WithPath(
|
|
65
|
-
'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
|
|
66
|
-
'interactive.unhelpful.label',
|
|
67
|
-
"Unhelpful"
|
|
68
|
-
)),
|
|
61
|
+
title: ( localize2WithPath(_moduleId, 1, "Unhelpful")),
|
|
69
62
|
f1: false,
|
|
70
63
|
category: CHAT_CATEGORY,
|
|
71
64
|
icon: Codicon.thumbsdown,
|
|
72
|
-
toggled: ( CONTEXT_RESPONSE_VOTE.isEqualTo('down')),
|
|
65
|
+
toggled: ( (CONTEXT_RESPONSE_VOTE.isEqualTo('down'))),
|
|
73
66
|
menu: {
|
|
74
67
|
id: MenuId.ChatMessageTitle,
|
|
75
68
|
group: 'navigation',
|
|
@@ -85,7 +78,6 @@ function registerChatTitleActions() {
|
|
|
85
78
|
}
|
|
86
79
|
const chatService = accessor.get(IChatService);
|
|
87
80
|
chatService.notifyUserAction({
|
|
88
|
-
providerId: item.providerId,
|
|
89
81
|
agentId: item.agent?.id,
|
|
90
82
|
sessionId: item.sessionId,
|
|
91
83
|
requestId: item.requestId,
|
|
@@ -102,11 +94,7 @@ function registerChatTitleActions() {
|
|
|
102
94
|
constructor() {
|
|
103
95
|
super({
|
|
104
96
|
id: 'workbench.action.chat.reportIssueForBug',
|
|
105
|
-
title: ( localize2WithPath(
|
|
106
|
-
'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
|
|
107
|
-
'interactive.reportIssueForBug.label',
|
|
108
|
-
"Report Issue"
|
|
109
|
-
)),
|
|
97
|
+
title: ( localize2WithPath(_moduleId, 2, "Report Issue")),
|
|
110
98
|
f1: false,
|
|
111
99
|
category: CHAT_CATEGORY,
|
|
112
100
|
icon: Codicon.report,
|
|
@@ -114,7 +102,7 @@ function registerChatTitleActions() {
|
|
|
114
102
|
id: MenuId.ChatMessageTitle,
|
|
115
103
|
group: 'navigation',
|
|
116
104
|
order: 3,
|
|
117
|
-
when: ( ContextKeyExpr.and(CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE))
|
|
105
|
+
when: ( (ContextKeyExpr.and(CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_RESPONSE)))
|
|
118
106
|
}
|
|
119
107
|
});
|
|
120
108
|
}
|
|
@@ -125,7 +113,6 @@ function registerChatTitleActions() {
|
|
|
125
113
|
}
|
|
126
114
|
const chatService = accessor.get(IChatService);
|
|
127
115
|
chatService.notifyUserAction({
|
|
128
|
-
providerId: item.providerId,
|
|
129
116
|
agentId: item.agent?.id,
|
|
130
117
|
sessionId: item.sessionId,
|
|
131
118
|
requestId: item.requestId,
|
|
@@ -140,11 +127,7 @@ function registerChatTitleActions() {
|
|
|
140
127
|
constructor() {
|
|
141
128
|
super({
|
|
142
129
|
id: 'workbench.action.chat.insertIntoNotebook',
|
|
143
|
-
title: ( localize2WithPath(
|
|
144
|
-
'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
|
|
145
|
-
'interactive.insertIntoNotebook.label',
|
|
146
|
-
"Insert into Notebook"
|
|
147
|
-
)),
|
|
130
|
+
title: ( localize2WithPath(_moduleId, 3, "Insert into Notebook")),
|
|
148
131
|
f1: false,
|
|
149
132
|
category: CHAT_CATEGORY,
|
|
150
133
|
icon: Codicon.insert,
|
|
@@ -152,7 +135,11 @@ function registerChatTitleActions() {
|
|
|
152
135
|
id: MenuId.ChatMessageTitle,
|
|
153
136
|
group: 'navigation',
|
|
154
137
|
isHiddenByDefault: true,
|
|
155
|
-
when: ( ContextKeyExpr.and(
|
|
138
|
+
when: ( (ContextKeyExpr.and(
|
|
139
|
+
NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
140
|
+
CONTEXT_RESPONSE,
|
|
141
|
+
(CONTEXT_RESPONSE_FILTERED.negate())
|
|
142
|
+
)))
|
|
156
143
|
}
|
|
157
144
|
});
|
|
158
145
|
}
|
|
@@ -176,11 +163,11 @@ function registerChatTitleActions() {
|
|
|
176
163
|
const index = Math.max(focusRange.end, 0);
|
|
177
164
|
const bulkEditService = accessor.get(IBulkEditService);
|
|
178
165
|
await bulkEditService.apply([
|
|
179
|
-
( new ResourceNotebookCellEdit(notebookEditor.textModel.uri, {
|
|
166
|
+
( (new ResourceNotebookCellEdit(notebookEditor.textModel.uri, {
|
|
180
167
|
editType: 1 ,
|
|
181
168
|
index: index,
|
|
182
169
|
count: 0,
|
|
183
|
-
cells: ( splitContents.map(content => {
|
|
170
|
+
cells: ( (splitContents.map(content => {
|
|
184
171
|
const kind = content.type === 'markdown' ? CellKind.Markup : CellKind.Code;
|
|
185
172
|
const language = content.type === 'markdown' ? 'markdown' : content.language;
|
|
186
173
|
const mime = content.type === 'markdown' ? 'text/markdown' : `text/x-${content.language}`;
|
|
@@ -192,8 +179,8 @@ function registerChatTitleActions() {
|
|
|
192
179
|
outputs: [],
|
|
193
180
|
metadata: {}
|
|
194
181
|
};
|
|
195
|
-
}))
|
|
196
|
-
}))
|
|
182
|
+
})))
|
|
183
|
+
})))
|
|
197
184
|
], { quotableLabel: 'Insert into Notebook' });
|
|
198
185
|
}
|
|
199
186
|
}
|
|
@@ -202,11 +189,7 @@ function registerChatTitleActions() {
|
|
|
202
189
|
constructor() {
|
|
203
190
|
super({
|
|
204
191
|
id: 'workbench.action.chat.remove',
|
|
205
|
-
title: ( localize2WithPath(
|
|
206
|
-
'vs/workbench/contrib/chat/browser/actions/chatTitleActions',
|
|
207
|
-
'chat.remove.label',
|
|
208
|
-
"Remove Request and Response"
|
|
209
|
-
)),
|
|
192
|
+
title: ( localize2WithPath(_moduleId, 4, "Remove Request and Response")),
|
|
210
193
|
f1: false,
|
|
211
194
|
category: CHAT_CATEGORY,
|
|
212
195
|
icon: Codicon.x,
|
|
@@ -215,7 +198,7 @@ function registerChatTitleActions() {
|
|
|
215
198
|
mac: {
|
|
216
199
|
primary: 2048 | 1 ,
|
|
217
200
|
},
|
|
218
|
-
when: ( ContextKeyExpr.and(CONTEXT_IN_CHAT_SESSION,
|
|
201
|
+
when: ( (ContextKeyExpr.and(CONTEXT_IN_CHAT_SESSION, (CONTEXT_IN_CHAT_INPUT.negate())))),
|
|
219
202
|
weight: 200 ,
|
|
220
203
|
},
|
|
221
204
|
menu: {
|
|
@@ -241,6 +224,85 @@ function registerChatTitleActions() {
|
|
|
241
224
|
}
|
|
242
225
|
}
|
|
243
226
|
});
|
|
227
|
+
const rerunMenu = MenuId.for('ChatMessageTitle#Rerun');
|
|
228
|
+
MenuRegistry.appendMenuItem(MenuId.ChatMessageTitle, {
|
|
229
|
+
submenu: rerunMenu,
|
|
230
|
+
title: ( localizeWithPath(_moduleId, 5, "Rerun...")),
|
|
231
|
+
icon: Codicon.refresh,
|
|
232
|
+
group: 'navigation',
|
|
233
|
+
order: -10,
|
|
234
|
+
when: ( (ContextKeyExpr.and(
|
|
235
|
+
CONTEXT_RESPONSE,
|
|
236
|
+
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor))
|
|
237
|
+
)))
|
|
238
|
+
});
|
|
239
|
+
registerAction2(class RerunAction extends Action2 {
|
|
240
|
+
constructor() {
|
|
241
|
+
super({
|
|
242
|
+
id: 'workbench.action.chat.rerun',
|
|
243
|
+
title: ( localize2WithPath(_moduleId, 6, "Rerun Request")),
|
|
244
|
+
f1: false,
|
|
245
|
+
category: CHAT_CATEGORY,
|
|
246
|
+
icon: Codicon.refresh,
|
|
247
|
+
precondition: ( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor))),
|
|
248
|
+
menu: {
|
|
249
|
+
id: rerunMenu,
|
|
250
|
+
group: 'navigation',
|
|
251
|
+
order: -1,
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async run(accessor, ...args) {
|
|
256
|
+
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
257
|
+
const chatService = accessor.get(IChatService);
|
|
258
|
+
const widget = chatWidgetService.lastFocusedWidget;
|
|
259
|
+
let item = args[0];
|
|
260
|
+
if (!isResponseVM(item)) {
|
|
261
|
+
item = widget?.getFocus();
|
|
262
|
+
}
|
|
263
|
+
if (!isResponseVM(item) || !widget) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const request = chatService.getSession(item.sessionId)?.getRequests().find(candidate => candidate.id === item.requestId);
|
|
267
|
+
if (request) {
|
|
268
|
+
await chatService.resendRequest(request, { noCommandDetection: false, attempt: request.attempt + 1, location: widget.location, implicitVariablesEnabled: true });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
registerAction2(class RerunWithoutCommandDetectionAction extends Action2 {
|
|
273
|
+
constructor() {
|
|
274
|
+
super({
|
|
275
|
+
id: 'workbench.action.chat.rerunWithoutCommandDetection',
|
|
276
|
+
title: ( localize2WithPath(_moduleId, 7, "Rerun without Command Detection")),
|
|
277
|
+
f1: false,
|
|
278
|
+
category: CHAT_CATEGORY,
|
|
279
|
+
icon: Codicon.refresh,
|
|
280
|
+
precondition: ( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor))),
|
|
281
|
+
menu: {
|
|
282
|
+
when: CONTEXT_RESPONSE_DETECTED_AGENT_COMMAND,
|
|
283
|
+
id: rerunMenu,
|
|
284
|
+
group: 'navigation',
|
|
285
|
+
order: -1,
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
async run(accessor, ...args) {
|
|
290
|
+
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
291
|
+
const chatService = accessor.get(IChatService);
|
|
292
|
+
const widget = chatWidgetService.lastFocusedWidget;
|
|
293
|
+
let item = args[0];
|
|
294
|
+
if (!isResponseVM(item)) {
|
|
295
|
+
item = widget?.getFocus();
|
|
296
|
+
}
|
|
297
|
+
if (!isResponseVM(item) || !widget) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const request = chatService.getSession(item.sessionId)?.getRequests().find(candidate => candidate.id === item.requestId);
|
|
301
|
+
if (request) {
|
|
302
|
+
await chatService.resendRequest(request, { noCommandDetection: true, attempt: request.attempt, location: widget.location, implicitVariablesEnabled: true });
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
});
|
|
244
306
|
}
|
|
245
307
|
function splitMarkdownAndCodeBlocks(markdown) {
|
|
246
308
|
const lexer = new marked_1.Lexer();
|