@theia/ai-chat-ui 1.63.0-next.52 → 1.63.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/lib/browser/ai-chat-ui-contribution.d.ts +2 -0
- package/lib/browser/ai-chat-ui-contribution.d.ts.map +1 -1
- package/lib/browser/ai-chat-ui-contribution.js +37 -9
- package/lib/browser/ai-chat-ui-contribution.js.map +1 -1
- package/lib/browser/chat-input-widget.d.ts +18 -11
- package/lib/browser/chat-input-widget.d.ts.map +1 -1
- package/lib/browser/chat-input-widget.js +121 -18
- package/lib/browser/chat-input-widget.js.map +1 -1
- package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts +4 -1
- package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts.map +1 -1
- package/lib/browser/chat-response-renderer/toolcall-part-renderer.js +58 -25
- package/lib/browser/chat-response-renderer/toolcall-part-renderer.js.map +1 -1
- package/lib/browser/chat-view-contribution.d.ts +2 -0
- package/lib/browser/chat-view-contribution.d.ts.map +1 -1
- package/lib/browser/chat-view-contribution.js +29 -17
- package/lib/browser/chat-view-contribution.js.map +1 -1
- package/lib/browser/chat-view-widget-toolbar-contribution.d.ts +2 -0
- package/lib/browser/chat-view-widget-toolbar-contribution.d.ts.map +1 -1
- package/lib/browser/chat-view-widget-toolbar-contribution.js +13 -5
- package/lib/browser/chat-view-widget-toolbar-contribution.js.map +1 -1
- package/package.json +11 -11
- package/src/browser/ai-chat-ui-contribution.ts +28 -10
- package/src/browser/chat-input-widget.tsx +148 -29
- package/src/browser/chat-response-renderer/toolcall-part-renderer.tsx +86 -51
- package/src/browser/chat-view-contribution.ts +28 -17
- package/src/browser/chat-view-widget-toolbar-contribution.tsx +12 -5
- package/src/browser/style/index.css +34 -5
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
isResponseNode, RequestNode, ResponseNode, type EditableRequestNode
|
|
23
23
|
} from './chat-tree-view/chat-view-tree-widget';
|
|
24
24
|
import { AIChatInputWidget } from './chat-input-widget';
|
|
25
|
+
import { AICommandHandlerFactory, ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser';
|
|
25
26
|
|
|
26
27
|
export namespace ChatViewCommands {
|
|
27
28
|
export const COPY_MESSAGE = Command.toDefaultLocalizedCommand({
|
|
@@ -51,8 +52,11 @@ export class ChatViewMenuContribution implements MenuContribution, CommandContri
|
|
|
51
52
|
@inject(CommandService)
|
|
52
53
|
protected readonly commandService: CommandService;
|
|
53
54
|
|
|
55
|
+
@inject(AICommandHandlerFactory)
|
|
56
|
+
protected readonly commandHandlerFactory: AICommandHandlerFactory;
|
|
57
|
+
|
|
54
58
|
registerCommands(commands: CommandRegistry): void {
|
|
55
|
-
commands.registerHandler(CommonCommands.COPY.id, {
|
|
59
|
+
commands.registerHandler(CommonCommands.COPY.id, this.commandHandlerFactory({
|
|
56
60
|
execute: (...args: unknown[]) => {
|
|
57
61
|
if (window.getSelection()?.type !== 'Range' && containsRequestOrResponseNode(args)) {
|
|
58
62
|
this.copyMessage(extractRequestOrResponseNodes(args));
|
|
@@ -61,16 +65,16 @@ export class ChatViewMenuContribution implements MenuContribution, CommandContri
|
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
isEnabled: (...args: unknown[]) => containsRequestOrResponseNode(args)
|
|
64
|
-
});
|
|
65
|
-
commands.registerCommand(ChatViewCommands.COPY_MESSAGE, {
|
|
68
|
+
}));
|
|
69
|
+
commands.registerCommand(ChatViewCommands.COPY_MESSAGE, this.commandHandlerFactory({
|
|
66
70
|
execute: (...args: unknown[]) => {
|
|
67
71
|
if (containsRequestOrResponseNode(args)) {
|
|
68
72
|
this.copyMessage(extractRequestOrResponseNodes(args));
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
isEnabled: (...args: unknown[]) => containsRequestOrResponseNode(args)
|
|
72
|
-
});
|
|
73
|
-
commands.registerCommand(ChatViewCommands.COPY_ALL, {
|
|
76
|
+
}));
|
|
77
|
+
commands.registerCommand(ChatViewCommands.COPY_ALL, this.commandHandlerFactory({
|
|
74
78
|
execute: (...args: unknown[]) => {
|
|
75
79
|
if (containsRequestOrResponseNode(args)) {
|
|
76
80
|
const parent = extractRequestOrResponseNodes(args).find(arg => arg.parent)?.parent;
|
|
@@ -84,8 +88,8 @@ export class ChatViewMenuContribution implements MenuContribution, CommandContri
|
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
90
|
isEnabled: (...args: unknown[]) => containsRequestOrResponseNode(args)
|
|
87
|
-
});
|
|
88
|
-
commands.registerCommand(ChatViewCommands.COPY_CODE, {
|
|
91
|
+
}));
|
|
92
|
+
commands.registerCommand(ChatViewCommands.COPY_CODE, this.commandHandlerFactory({
|
|
89
93
|
execute: (...args: unknown[]) => {
|
|
90
94
|
if (containsCode(args)) {
|
|
91
95
|
const code = args
|
|
@@ -96,14 +100,14 @@ export class ChatViewMenuContribution implements MenuContribution, CommandContri
|
|
|
96
100
|
}
|
|
97
101
|
},
|
|
98
102
|
isEnabled: (...args: unknown[]) => containsRequestOrResponseNode(args) && containsCode(args)
|
|
99
|
-
});
|
|
100
|
-
commands.registerCommand(ChatViewCommands.EDIT, {
|
|
103
|
+
}));
|
|
104
|
+
commands.registerCommand(ChatViewCommands.EDIT, this.commandHandlerFactory({
|
|
101
105
|
execute: (...args: [EditableRequestNode, ...unknown[]]) => {
|
|
102
106
|
args[0].request.enableEdit();
|
|
103
107
|
},
|
|
104
108
|
isEnabled: (...args: unknown[]) => hasAsFirstArg(args, isEditableRequestNode) && !args[0].request.isEditing,
|
|
105
109
|
isVisible: (...args: unknown[]) => hasAsFirstArg(args, isEditableRequestNode) && !args[0].request.isEditing
|
|
106
|
-
});
|
|
110
|
+
}));
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
protected copyMessage(args: (RequestNode | ResponseNode)[]): void {
|
|
@@ -126,25 +130,32 @@ export class ChatViewMenuContribution implements MenuContribution, CommandContri
|
|
|
126
130
|
|
|
127
131
|
registerMenus(menus: MenuModelRegistry): void {
|
|
128
132
|
menus.registerMenuAction([...ChatViewTreeWidget.CONTEXT_MENU, '_1'], {
|
|
129
|
-
commandId: CommonCommands.COPY.id
|
|
133
|
+
commandId: CommonCommands.COPY.id,
|
|
134
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
130
135
|
});
|
|
131
136
|
menus.registerMenuAction([...ChatViewTreeWidget.CONTEXT_MENU, '_1'], {
|
|
132
|
-
commandId: ChatViewCommands.COPY_MESSAGE.id
|
|
137
|
+
commandId: ChatViewCommands.COPY_MESSAGE.id,
|
|
138
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
133
139
|
});
|
|
134
140
|
menus.registerMenuAction([...ChatViewTreeWidget.CONTEXT_MENU, '_1'], {
|
|
135
|
-
commandId: ChatViewCommands.COPY_ALL.id
|
|
141
|
+
commandId: ChatViewCommands.COPY_ALL.id,
|
|
142
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
136
143
|
});
|
|
137
144
|
menus.registerMenuAction([...ChatViewTreeWidget.CONTEXT_MENU, '_1'], {
|
|
138
|
-
commandId: ChatViewCommands.COPY_CODE.id
|
|
145
|
+
commandId: ChatViewCommands.COPY_CODE.id,
|
|
146
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
139
147
|
});
|
|
140
148
|
menus.registerMenuAction([...ChatViewTreeWidget.CONTEXT_MENU, '_1'], {
|
|
141
|
-
commandId: ChatViewCommands.EDIT.id
|
|
149
|
+
commandId: ChatViewCommands.EDIT.id,
|
|
150
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
142
151
|
});
|
|
143
152
|
menus.registerMenuAction([...AIChatInputWidget.CONTEXT_MENU, '_1'], {
|
|
144
|
-
commandId: CommonCommands.COPY.id
|
|
153
|
+
commandId: CommonCommands.COPY.id,
|
|
154
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
145
155
|
});
|
|
146
156
|
menus.registerMenuAction([...AIChatInputWidget.CONTEXT_MENU, '_1'], {
|
|
147
|
-
commandId: CommonCommands.PASTE.id
|
|
157
|
+
commandId: CommonCommands.PASTE.id,
|
|
158
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
148
159
|
});
|
|
149
160
|
}
|
|
150
161
|
}
|
|
@@ -23,6 +23,7 @@ import { CommandRegistry } from '@theia/core/lib/common/command';
|
|
|
23
23
|
import { SessionSettingsDialog } from './session-settings-dialog';
|
|
24
24
|
import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
|
|
25
25
|
import { ChatViewWidget } from './chat-view-widget';
|
|
26
|
+
import { AIActivationService, ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser';
|
|
26
27
|
|
|
27
28
|
@injectable()
|
|
28
29
|
export class ChatViewWidgetToolbarContribution implements TabBarToolbarContribution {
|
|
@@ -38,6 +39,9 @@ export class ChatViewWidgetToolbarContribution implements TabBarToolbarContribut
|
|
|
38
39
|
@inject(InMemoryResources)
|
|
39
40
|
protected readonly resources: InMemoryResources;
|
|
40
41
|
|
|
42
|
+
@inject(AIActivationService)
|
|
43
|
+
protected readonly activationService: AIActivationService;
|
|
44
|
+
|
|
41
45
|
protected readonly onChatWidgetStateChangedEmitter = new Emitter<void>();
|
|
42
46
|
protected readonly onChatWidgetStateChanged = this.onChatWidgetStateChangedEmitter.event;
|
|
43
47
|
|
|
@@ -53,8 +57,8 @@ export class ChatViewWidgetToolbarContribution implements TabBarToolbarContribut
|
|
|
53
57
|
|
|
54
58
|
this.commandRegistry.registerCommand(ChatCommands.EDIT_SESSION_SETTINGS, {
|
|
55
59
|
execute: () => this.openJsonDataDialog(),
|
|
56
|
-
isEnabled: widget => widget instanceof ChatViewWidget,
|
|
57
|
-
isVisible: widget => widget instanceof ChatViewWidget
|
|
60
|
+
isEnabled: widget => this.activationService.isActive && widget instanceof ChatViewWidget,
|
|
61
|
+
isVisible: widget => this.activationService.isActive && widget instanceof ChatViewWidget
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -64,20 +68,23 @@ export class ChatViewWidgetToolbarContribution implements TabBarToolbarContribut
|
|
|
64
68
|
command: ChatCommands.SCROLL_LOCK_WIDGET.id,
|
|
65
69
|
tooltip: nls.localizeByDefault('Turn Auto Scrolling Off'),
|
|
66
70
|
onDidChange: this.onChatWidgetStateChanged,
|
|
67
|
-
priority: 2
|
|
71
|
+
priority: 2,
|
|
72
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
68
73
|
});
|
|
69
74
|
registry.registerItem({
|
|
70
75
|
id: ChatCommands.SCROLL_UNLOCK_WIDGET.id,
|
|
71
76
|
command: ChatCommands.SCROLL_UNLOCK_WIDGET.id,
|
|
72
77
|
tooltip: nls.localizeByDefault('Turn Auto Scrolling On'),
|
|
73
78
|
onDidChange: this.onChatWidgetStateChanged,
|
|
74
|
-
priority: 2
|
|
79
|
+
priority: 2,
|
|
80
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
75
81
|
});
|
|
76
82
|
registry.registerItem({
|
|
77
83
|
id: ChatCommands.EDIT_SESSION_SETTINGS.id,
|
|
78
84
|
command: ChatCommands.EDIT_SESSION_SETTINGS.id,
|
|
79
85
|
tooltip: nls.localize('theia/ai/session-settings-dialog/tooltip', 'Set Session Settings'),
|
|
80
|
-
priority: 3
|
|
86
|
+
priority: 3,
|
|
87
|
+
when: ENABLE_AI_CONTEXT_KEY
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
|
|
@@ -194,6 +194,16 @@ div:last-child > .theia-ChatNode {
|
|
|
194
194
|
gap: 4px;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
.theia-ChatInput[data-ai-disabled="true"] {
|
|
198
|
+
opacity: var(--theia-mod-disabled-opacity);
|
|
199
|
+
pointer-events: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.theia-ChatInput[data-ai-disabled="true"] .theia-ChatInput-Editor-Placeholder {
|
|
203
|
+
color: var(--theia-input-disabledForeground);
|
|
204
|
+
font-family: var(--theia-ui-font-family);
|
|
205
|
+
}
|
|
206
|
+
|
|
197
207
|
.theia-ChatInput-ChatContext ul {
|
|
198
208
|
list-style-type: none;
|
|
199
209
|
padding: 0px 4px 8px 8px;
|
|
@@ -220,6 +230,8 @@ div:last-child > .theia-ChatNode {
|
|
|
220
230
|
display: flex;
|
|
221
231
|
align-items: center;
|
|
222
232
|
width: 100%;
|
|
233
|
+
color: var(--theia-foreground);
|
|
234
|
+
font-family: var(--theia-ui-font-family);
|
|
223
235
|
}
|
|
224
236
|
|
|
225
237
|
.theia-ChatInput-ChatContext-labelParts {
|
|
@@ -484,6 +496,7 @@ div:last-child > .theia-ChatNode {
|
|
|
484
496
|
pointer-events: none;
|
|
485
497
|
z-index: 10;
|
|
486
498
|
text-align: left;
|
|
499
|
+
font-family: var(--theia-ui-font-family);
|
|
487
500
|
}
|
|
488
501
|
|
|
489
502
|
.theia-ChatInput-Editor-Placeholder.hidden {
|
|
@@ -536,6 +549,7 @@ div:last-child > .theia-ChatNode {
|
|
|
536
549
|
padding-right: 6px;
|
|
537
550
|
display: flex;
|
|
538
551
|
justify-content: space-between;
|
|
552
|
+
color: var(--theia-foreground);
|
|
539
553
|
}
|
|
540
554
|
|
|
541
555
|
.theia-ChatInputOptions .theia-ChatInputOptions-left,
|
|
@@ -821,14 +835,29 @@ div:last-child > .theia-ChatNode {
|
|
|
821
835
|
color: var(--theia-errorForeground);
|
|
822
836
|
}
|
|
823
837
|
|
|
824
|
-
.theia-
|
|
838
|
+
.theia-toolCall-denied,
|
|
839
|
+
.theia-toolCall-finished summary,
|
|
840
|
+
.theia-toolCall-allowed,
|
|
841
|
+
.theia-toolCall-waiting {
|
|
842
|
+
font-weight: bold;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.theia-toolCall-allowed .codicon-loading {
|
|
846
|
+
font-size: 1em;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.theia-toolCall-pending {
|
|
825
850
|
color: var(--theia-descriptionForeground);
|
|
826
851
|
}
|
|
827
852
|
|
|
828
|
-
.theia-
|
|
853
|
+
.theia-toolCall-denied {
|
|
829
854
|
color: var(--theia-errorForeground);
|
|
830
855
|
}
|
|
831
856
|
|
|
857
|
+
.theia-toolCall-response-result {
|
|
858
|
+
font-weight: normal;
|
|
859
|
+
}
|
|
860
|
+
|
|
832
861
|
.theia-toolCall .fa,
|
|
833
862
|
.theia-toolCall details summary::marker,
|
|
834
863
|
.theia-thinking .fa,
|
|
@@ -987,7 +1016,7 @@ details[open].collapsible-arguments .collapsible-arguments-summary {
|
|
|
987
1016
|
}
|
|
988
1017
|
|
|
989
1018
|
.delegation-summary::before {
|
|
990
|
-
content:
|
|
1019
|
+
content: "\25BC";
|
|
991
1020
|
/* Down arrow */
|
|
992
1021
|
position: absolute;
|
|
993
1022
|
right: 8px;
|
|
@@ -1013,7 +1042,7 @@ details[open].collapsible-arguments .collapsible-arguments-summary {
|
|
|
1013
1042
|
}
|
|
1014
1043
|
|
|
1015
1044
|
.delegation-summary::marker {
|
|
1016
|
-
content:
|
|
1045
|
+
content: "";
|
|
1017
1046
|
}
|
|
1018
1047
|
|
|
1019
1048
|
.delegation-header {
|
|
@@ -1089,7 +1118,7 @@ details[open].collapsible-arguments .collapsible-arguments-summary {
|
|
|
1089
1118
|
margin-top: 16px;
|
|
1090
1119
|
}
|
|
1091
1120
|
|
|
1092
|
-
.delegation-response-section>strong {
|
|
1121
|
+
.delegation-response-section > strong {
|
|
1093
1122
|
display: block;
|
|
1094
1123
|
margin-bottom: 8px;
|
|
1095
1124
|
color: var(--theia-foreground);
|