@opensumi/ide-ai-native 3.8.3-next-1741917543.0 → 3.8.3-next-1741920696.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/chat/chat-agent.service.d.ts +1 -1
- package/lib/browser/chat/chat-agent.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-agent.service.js +7 -7
- package/lib/browser/chat/chat-agent.service.js.map +1 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +69 -31
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatEditor.d.ts +11 -2
- package/lib/browser/components/ChatEditor.d.ts.map +1 -1
- package/lib/browser/components/ChatEditor.js +60 -6
- package/lib/browser/components/ChatEditor.js.map +1 -1
- package/lib/browser/components/ChatHistory.d.ts.map +1 -1
- package/lib/browser/components/ChatHistory.js +15 -15
- package/lib/browser/components/ChatHistory.js.map +1 -1
- package/lib/browser/components/ChatMentionInput.d.ts +25 -0
- package/lib/browser/components/ChatMentionInput.d.ts.map +1 -0
- package/lib/browser/components/ChatMentionInput.js +229 -0
- package/lib/browser/components/ChatMentionInput.js.map +1 -0
- package/lib/browser/components/ChatThinking.d.ts +1 -1
- package/lib/browser/components/ChatThinking.d.ts.map +1 -1
- package/lib/browser/components/ChatThinking.js +8 -2
- package/lib/browser/components/ChatThinking.js.map +1 -1
- package/lib/browser/components/change-list.module.less +2 -0
- package/lib/browser/components/{ChatContext/ContextSelector.d.ts → chat-context/context-selector.d.ts} +1 -1
- package/lib/browser/components/chat-context/context-selector.d.ts.map +1 -0
- package/lib/browser/components/{ChatContext/ContextSelector.js → chat-context/context-selector.js} +1 -1
- package/lib/browser/components/chat-context/context-selector.js.map +1 -0
- package/lib/browser/components/chat-context/index.d.ts.map +1 -0
- package/lib/browser/components/{ChatContext → chat-context}/index.js +2 -2
- package/lib/browser/components/chat-context/index.js.map +1 -0
- package/lib/browser/components/chat-history.module.less +33 -16
- package/lib/browser/components/components.module.less +39 -3
- package/lib/browser/components/mention-input/mention-input.d.ts +5 -0
- package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -0
- package/lib/browser/components/mention-input/mention-input.js +763 -0
- package/lib/browser/components/mention-input/mention-input.js.map +1 -0
- package/lib/browser/components/mention-input/mention-input.module.less +333 -0
- package/lib/browser/components/mention-input/mention-item.d.ts +10 -0
- package/lib/browser/components/mention-input/mention-item.d.ts.map +1 -0
- package/lib/browser/components/mention-input/mention-item.js +16 -0
- package/lib/browser/components/mention-input/mention-item.js.map +1 -0
- package/lib/browser/components/mention-input/mention-panel.d.ts +15 -0
- package/lib/browser/components/mention-input/mention-panel.d.ts.map +1 -0
- package/lib/browser/components/mention-input/mention-panel.js +49 -0
- package/lib/browser/components/mention-input/mention-panel.js.map +1 -0
- package/lib/browser/components/mention-input/types.d.ts +78 -0
- package/lib/browser/components/mention-input/types.d.ts.map +1 -0
- package/lib/browser/components/mention-input/types.js +16 -0
- package/lib/browser/components/mention-input/types.js.map +1 -0
- package/lib/browser/context/llm-context.service.d.ts +10 -2
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js +76 -2
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.module.less +61 -30
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.view.js +17 -19
- package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-server-form.js +1 -1
- package/lib/browser/mcp/config/components/mcp-server-form.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-server-form.module.less +3 -0
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts +1 -0
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts.map +1 -1
- package/lib/common/index.d.ts +2 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/llm-context.d.ts +15 -1
- package/lib/common/llm-context.d.ts.map +1 -1
- package/lib/common/llm-context.js.map +1 -1
- package/lib/common/prompts/context-prompt-provider.d.ts +12 -2
- package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
- package/lib/common/prompts/context-prompt-provider.js +95 -30
- package/lib/common/prompts/context-prompt-provider.js.map +1 -1
- package/lib/common/types.d.ts +1 -1
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +9 -1
- package/lib/common/utils.js.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.d.ts +3 -3
- package/lib/node/mcp/sumi-mcp-server.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.js +11 -7
- package/lib/node/mcp/sumi-mcp-server.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/chat/chat-agent.service.ts +7 -7
- package/src/browser/chat/chat.view.tsx +81 -24
- package/src/browser/components/ChatEditor.tsx +128 -9
- package/src/browser/components/ChatHistory.tsx +16 -30
- package/src/browser/components/ChatMentionInput.tsx +276 -0
- package/src/browser/components/ChatThinking.tsx +10 -4
- package/src/browser/components/change-list.module.less +2 -0
- package/src/browser/components/{ChatContext → chat-context}/index.tsx +1 -1
- package/src/browser/components/chat-history.module.less +33 -16
- package/src/browser/components/components.module.less +39 -3
- package/src/browser/components/mention-input/mention-input.module.less +333 -0
- package/src/browser/components/mention-input/mention-input.tsx +952 -0
- package/src/browser/components/mention-input/mention-item.tsx +24 -0
- package/src/browser/components/mention-input/mention-panel.tsx +89 -0
- package/src/browser/components/mention-input/types.ts +84 -0
- package/src/browser/context/llm-context.service.ts +85 -3
- package/src/browser/mcp/config/components/mcp-config.module.less +61 -30
- package/src/browser/mcp/config/components/mcp-config.view.tsx +49 -32
- package/src/browser/mcp/config/components/mcp-server-form.module.less +3 -0
- package/src/browser/mcp/config/components/mcp-server-form.tsx +1 -1
- package/src/common/index.ts +2 -2
- package/src/common/llm-context.ts +16 -1
- package/src/common/prompts/context-prompt-provider.ts +130 -36
- package/src/common/types.ts +1 -1
- package/src/common/utils.ts +8 -0
- package/src/node/mcp/sumi-mcp-server.ts +11 -7
- package/lib/browser/components/ChatContext/ContextSelector.d.ts.map +0 -1
- package/lib/browser/components/ChatContext/ContextSelector.js.map +0 -1
- package/lib/browser/components/ChatContext/index.d.ts.map +0 -1
- package/lib/browser/components/ChatContext/index.js.map +0 -1
- /package/lib/browser/components/{ChatContext → chat-context}/index.d.ts +0 -0
- /package/lib/browser/components/{ChatContext → chat-context}/style.module.less +0 -0
- /package/src/browser/components/{ChatContext/ContextSelector.tsx → chat-context/context-selector.tsx} +0 -0
- /package/src/browser/components/{ChatContext → chat-context}/style.module.less +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { LabelService, RecentFilesManager, useInjectable } from '@opensumi/ide-core-browser';
|
|
4
|
+
import { getIcon } from '@opensumi/ide-core-browser/lib/components';
|
|
5
|
+
import { URI, localize } from '@opensumi/ide-core-common';
|
|
6
|
+
import { CommandService } from '@opensumi/ide-core-common/lib/command';
|
|
7
|
+
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
8
|
+
import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search';
|
|
9
|
+
import { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
10
|
+
|
|
11
|
+
import { IChatInternalService } from '../../common';
|
|
12
|
+
import { ChatInternalService } from '../chat/chat.internal.service';
|
|
13
|
+
import { OPEN_MCP_CONFIG_COMMAND } from '../mcp/config/mcp-config.commands';
|
|
14
|
+
|
|
15
|
+
import styles from './components.module.less';
|
|
16
|
+
import { MentionInput } from './mention-input/mention-input';
|
|
17
|
+
import { FooterButtonPosition, FooterConfig, MentionItem, MentionType } from './mention-input/types';
|
|
18
|
+
|
|
19
|
+
export interface IChatMentionInputProps {
|
|
20
|
+
onSend: (value: string, agentId?: string, command?: string, option?: { model: string; [key: string]: any }) => void;
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
22
|
+
onExpand?: (value: boolean) => void;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
enableOptions?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
sendBtnClassName?: string;
|
|
27
|
+
defaultHeight?: number;
|
|
28
|
+
value?: string;
|
|
29
|
+
autoFocus?: boolean;
|
|
30
|
+
theme?: string | null;
|
|
31
|
+
setTheme: (theme: string | null) => void;
|
|
32
|
+
agentId: string;
|
|
33
|
+
setAgentId: (id: string) => void;
|
|
34
|
+
defaultAgentId?: string;
|
|
35
|
+
command: string;
|
|
36
|
+
setCommand: (command: string) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 指令命令激活组件
|
|
40
|
+
export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
41
|
+
const { onSend, disabled = false } = props;
|
|
42
|
+
|
|
43
|
+
const [value, setValue] = useState(props.value || '');
|
|
44
|
+
const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
|
|
45
|
+
const commandService = useInjectable<CommandService>(CommandService);
|
|
46
|
+
const searchService = useInjectable<IFileSearchService>(FileSearchServicePath);
|
|
47
|
+
const recentFilesManager = useInjectable<RecentFilesManager>(RecentFilesManager);
|
|
48
|
+
const workspaceService = useInjectable<IWorkspaceService>(IWorkspaceService);
|
|
49
|
+
const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
|
|
50
|
+
const labelService = useInjectable<LabelService>(LabelService);
|
|
51
|
+
|
|
52
|
+
const handleShowMCPConfig = React.useCallback(() => {
|
|
53
|
+
commandService.executeCommand(OPEN_MCP_CONFIG_COMMAND.id);
|
|
54
|
+
}, [commandService]);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (props.value !== value) {
|
|
58
|
+
setValue(props.value || '');
|
|
59
|
+
}
|
|
60
|
+
}, [props.value]);
|
|
61
|
+
|
|
62
|
+
// 默认菜单项
|
|
63
|
+
const defaultMenuItems: MentionItem[] = [
|
|
64
|
+
// {
|
|
65
|
+
// id: 'code',
|
|
66
|
+
// type: 'code',
|
|
67
|
+
// text: 'Code',
|
|
68
|
+
// icon: getIcon('codebraces'),
|
|
69
|
+
// getHighestLevelItems: () => [],
|
|
70
|
+
// getItems: async (searchText: string) => {
|
|
71
|
+
// const currentEditor = editorService.currentEditor;
|
|
72
|
+
// if (!currentEditor) {
|
|
73
|
+
// return [];
|
|
74
|
+
// }
|
|
75
|
+
// const currentDocumentModel = currentEditor.currentDocumentModel;
|
|
76
|
+
// if (!currentDocumentModel) {
|
|
77
|
+
// return [];
|
|
78
|
+
// }
|
|
79
|
+
// const symbols = await commandService.executeCommand('_executeFormatDocumentProvider', currentDocumentModel.uri.codeUri);
|
|
80
|
+
// return [];
|
|
81
|
+
// },
|
|
82
|
+
// },
|
|
83
|
+
{
|
|
84
|
+
id: MentionType.FILE,
|
|
85
|
+
type: MentionType.FILE,
|
|
86
|
+
text: 'File',
|
|
87
|
+
icon: getIcon('file'),
|
|
88
|
+
getHighestLevelItems: () => {
|
|
89
|
+
const currentEditor = editorService.currentEditor;
|
|
90
|
+
const currentUri = currentEditor?.currentUri;
|
|
91
|
+
if (!currentUri) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
id: currentUri.codeUri.fsPath,
|
|
97
|
+
type: MentionType.FILE,
|
|
98
|
+
text: currentUri.displayName,
|
|
99
|
+
value: currentUri.codeUri.fsPath,
|
|
100
|
+
description: `(${localize('aiNative.chat.defaultContextFile')})`,
|
|
101
|
+
contextId: currentUri.codeUri.fsPath,
|
|
102
|
+
icon: labelService.getIcon(currentUri),
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
},
|
|
106
|
+
getItems: async (searchText: string) => {
|
|
107
|
+
if (!searchText) {
|
|
108
|
+
const recentFile = await recentFilesManager.getMostRecentlyOpenedFiles();
|
|
109
|
+
return Promise.all(
|
|
110
|
+
recentFile.map(async (file) => {
|
|
111
|
+
const uri = new URI(file);
|
|
112
|
+
const relatveParentPath = (await workspaceService.asRelativePath(uri.parent))?.path;
|
|
113
|
+
return {
|
|
114
|
+
id: uri.codeUri.fsPath,
|
|
115
|
+
type: MentionType.FILE,
|
|
116
|
+
text: uri.displayName,
|
|
117
|
+
value: uri.codeUri.fsPath,
|
|
118
|
+
description: relatveParentPath || '',
|
|
119
|
+
contextId: uri.codeUri.fsPath,
|
|
120
|
+
icon: labelService.getIcon(uri),
|
|
121
|
+
};
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
} else {
|
|
125
|
+
const rootUris = (await workspaceService.roots).map((root) => new URI(root.uri).codeUri.fsPath.toString());
|
|
126
|
+
const results = await searchService.find(searchText, {
|
|
127
|
+
rootUris,
|
|
128
|
+
useGitIgnore: true,
|
|
129
|
+
noIgnoreParent: true,
|
|
130
|
+
fuzzyMatch: true,
|
|
131
|
+
limit: 10,
|
|
132
|
+
});
|
|
133
|
+
return Promise.all(
|
|
134
|
+
results.map(async (file) => {
|
|
135
|
+
const uri = new URI(file);
|
|
136
|
+
const relatveParentPath = (await workspaceService.asRelativePath(uri.parent))?.path;
|
|
137
|
+
return {
|
|
138
|
+
id: uri.codeUri.fsPath,
|
|
139
|
+
type: MentionType.FILE,
|
|
140
|
+
text: uri.displayName,
|
|
141
|
+
value: uri.codeUri.fsPath,
|
|
142
|
+
description: relatveParentPath || '',
|
|
143
|
+
contextId: uri.codeUri.fsPath,
|
|
144
|
+
icon: labelService.getIcon(uri),
|
|
145
|
+
};
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: MentionType.FOLDER,
|
|
153
|
+
type: MentionType.FOLDER,
|
|
154
|
+
text: 'Folder',
|
|
155
|
+
icon: getIcon('folder'),
|
|
156
|
+
getHighestLevelItems: () => {
|
|
157
|
+
const currentEditor = editorService.currentEditor;
|
|
158
|
+
const currentFolderUri = currentEditor?.currentUri?.parent;
|
|
159
|
+
if (!currentFolderUri) {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
if (currentFolderUri.toString() === workspaceService.workspace?.uri) {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
return [
|
|
166
|
+
{
|
|
167
|
+
id: currentFolderUri.codeUri.fsPath,
|
|
168
|
+
type: MentionType.FOLDER,
|
|
169
|
+
text: currentFolderUri.displayName,
|
|
170
|
+
value: currentFolderUri.codeUri.fsPath,
|
|
171
|
+
description: `(${localize('aiNative.chat.defaultContextFolder')})`,
|
|
172
|
+
contextId: currentFolderUri.codeUri.fsPath,
|
|
173
|
+
icon: getIcon('folder'),
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
},
|
|
177
|
+
getItems: async (searchText: string) => {
|
|
178
|
+
let folders: MentionItem[] = [];
|
|
179
|
+
if (!searchText) {
|
|
180
|
+
const recentFile = await recentFilesManager.getMostRecentlyOpenedFiles();
|
|
181
|
+
const recentFolder = Array.from(new Set(recentFile.map((file) => new URI(file).parent.codeUri.fsPath)));
|
|
182
|
+
folders = await Promise.all(
|
|
183
|
+
recentFolder.map(async (folder) => {
|
|
184
|
+
const uri = new URI(folder);
|
|
185
|
+
const relativePath = await workspaceService.asRelativePath(uri);
|
|
186
|
+
return {
|
|
187
|
+
id: uri.codeUri.fsPath,
|
|
188
|
+
type: MentionType.FOLDER,
|
|
189
|
+
text: uri.displayName,
|
|
190
|
+
value: uri.codeUri.fsPath,
|
|
191
|
+
description: relativePath?.root ? relativePath.path : '',
|
|
192
|
+
contextId: uri.codeUri.fsPath,
|
|
193
|
+
icon: getIcon('folder'),
|
|
194
|
+
};
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
} else {
|
|
198
|
+
const rootUris = (await workspaceService.roots).map((root) => new URI(root.uri).codeUri.fsPath);
|
|
199
|
+
const results = await searchService.find(searchText, {
|
|
200
|
+
rootUris,
|
|
201
|
+
useGitIgnore: true,
|
|
202
|
+
noIgnoreParent: true,
|
|
203
|
+
fuzzyMatch: true,
|
|
204
|
+
limit: 10,
|
|
205
|
+
onlyFolders: true,
|
|
206
|
+
});
|
|
207
|
+
folders = await Promise.all(
|
|
208
|
+
results.map(async (folder) => {
|
|
209
|
+
const uri = new URI(folder);
|
|
210
|
+
return {
|
|
211
|
+
id: uri.codeUri.fsPath,
|
|
212
|
+
type: MentionType.FOLDER,
|
|
213
|
+
text: uri.displayName,
|
|
214
|
+
value: uri.codeUri.fsPath,
|
|
215
|
+
description: (await workspaceService.asRelativePath(uri.parent))?.path || '',
|
|
216
|
+
contextId: uri.codeUri.fsPath,
|
|
217
|
+
icon: getIcon('folder'),
|
|
218
|
+
};
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return folders.filter((folder) => folder.id !== new URI(workspaceService.workspace?.uri).codeUri.fsPath);
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
const defaultMentionInputFooterOptions: FooterConfig = useMemo(
|
|
228
|
+
() => ({
|
|
229
|
+
modelOptions: [
|
|
230
|
+
{ label: 'QWQ 32B', value: 'qwq-32b' },
|
|
231
|
+
{ label: 'DeepSeek R1', value: 'deepseek-r1' },
|
|
232
|
+
],
|
|
233
|
+
defaultModel: 'deepseek-r1',
|
|
234
|
+
buttons: [
|
|
235
|
+
{
|
|
236
|
+
id: 'mcp-server',
|
|
237
|
+
icon: 'mcp',
|
|
238
|
+
title: 'MCP Server',
|
|
239
|
+
onClick: handleShowMCPConfig,
|
|
240
|
+
position: FooterButtonPosition.LEFT,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
showModelSelector: true,
|
|
244
|
+
}),
|
|
245
|
+
[handleShowMCPConfig],
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
const handleStop = useCallback(() => {
|
|
249
|
+
aiChatService.cancelRequest();
|
|
250
|
+
}, []);
|
|
251
|
+
|
|
252
|
+
const handleSend = useCallback(
|
|
253
|
+
async (content: string, option?: { model: string; [key: string]: any }) => {
|
|
254
|
+
if (disabled) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
onSend(content, undefined, undefined, option);
|
|
258
|
+
},
|
|
259
|
+
[onSend, editorService, disabled],
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<div className={styles.chat_input_container}>
|
|
264
|
+
<MentionInput
|
|
265
|
+
mentionItems={defaultMenuItems}
|
|
266
|
+
onSend={handleSend}
|
|
267
|
+
onStop={handleStop}
|
|
268
|
+
loading={disabled}
|
|
269
|
+
labelService={labelService}
|
|
270
|
+
workspaceService={workspaceService}
|
|
271
|
+
placeholder={localize('aiNative.chat.input.placeholder.default')}
|
|
272
|
+
footerConfig={defaultMentionInputFooterOptions}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
);
|
|
276
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useInjectable } from '@opensumi/ide-core-browser';
|
|
4
|
-
import { Icon, getIcon } from '@opensumi/ide-core-browser/lib/components';
|
|
5
4
|
import { EnhanceIcon, Thumbs } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
6
5
|
import { Progress } from '@opensumi/ide-core-browser/lib/progress/progress-bar';
|
|
7
6
|
import { ChatRenderRegistryToken, isUndefined, localize } from '@opensumi/ide-core-common';
|
|
@@ -13,7 +12,7 @@ import { ChatRenderRegistry } from '../chat/chat.render.registry';
|
|
|
13
12
|
import styles from './components.module.less';
|
|
14
13
|
|
|
15
14
|
interface ITinkingProps {
|
|
16
|
-
children?: React.ReactNode;
|
|
15
|
+
children?: React.ReactNode | string | React.ReactNode[];
|
|
17
16
|
hasMessage?: boolean;
|
|
18
17
|
message?: string;
|
|
19
18
|
onRegenerate?: () => void;
|
|
@@ -32,8 +31,15 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
32
31
|
[chatRenderRegistry, chatRenderRegistry.chatThinkingRender],
|
|
33
32
|
);
|
|
34
33
|
|
|
34
|
+
const isEmptyChildren = useMemo(() => {
|
|
35
|
+
if (Array.isArray(children)) {
|
|
36
|
+
return children.length === 0;
|
|
37
|
+
}
|
|
38
|
+
return !children;
|
|
39
|
+
}, [children]);
|
|
40
|
+
|
|
35
41
|
const renderContent = useCallback(() => {
|
|
36
|
-
if (
|
|
42
|
+
if (isEmptyChildren) {
|
|
37
43
|
if (CustomThinkingRender) {
|
|
38
44
|
return <CustomThinkingRender thinkingText={thinkingText} />;
|
|
39
45
|
}
|
|
@@ -52,7 +58,7 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
52
58
|
{!CustomThinkingRender && (
|
|
53
59
|
<span className={styles.progress_bar}>
|
|
54
60
|
{/* 保持动画效果一致 */}
|
|
55
|
-
{
|
|
61
|
+
{isEmptyChildren && <Progress loading={true} wrapperClassName={styles.ai_native_progress_wrapper} />}
|
|
56
62
|
</span>
|
|
57
63
|
)}
|
|
58
64
|
{/* {showStop && (
|
|
@@ -15,7 +15,7 @@ import { WorkbenchEditorService } from '@opensumi/ide-editor/lib/browser/types';
|
|
|
15
15
|
|
|
16
16
|
import { FileContext, LLMContextService, LLMContextServiceToken } from '../../../common/llm-context';
|
|
17
17
|
|
|
18
|
-
import { ContextSelector } from './
|
|
18
|
+
import { ContextSelector } from './context-selector';
|
|
19
19
|
import styles from './style.module.less';
|
|
20
20
|
|
|
21
21
|
const getCollapsedHeight = () => ({ height: 0, opacity: 0 });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.chat_history_header {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
text-overflow: ellipsis;
|
|
9
9
|
white-space: nowrap;
|
|
10
10
|
|
|
11
|
-
.
|
|
11
|
+
.chat_history_header_title {
|
|
12
12
|
opacity: 0.6;
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
@@ -22,22 +22,34 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
25
|
+
.chat_history_header_actions {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
28
|
font-size: 12px;
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.chat_history_header_actions_history {
|
|
31
31
|
cursor: pointer;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.chat_history_header_actions_new {
|
|
35
35
|
margin-left: 2px;
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
:global {
|
|
40
|
+
.kt-popover-title {
|
|
41
|
+
margin-bottom: 8px;
|
|
42
|
+
}
|
|
43
|
+
.kt-popover-content {
|
|
44
|
+
background-color: var(--editor-background);
|
|
45
|
+
color: var(--editor-foreground);
|
|
46
|
+
}
|
|
47
|
+
.kt-popover-arrow {
|
|
48
|
+
border-bottom-color: var(--editor-background);
|
|
49
|
+
}
|
|
50
|
+
.kt-popover {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
54
|
}
|
|
43
55
|
|
|
@@ -75,7 +87,12 @@
|
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
.
|
|
90
|
+
.chat_history_search {
|
|
91
|
+
width: 100%;
|
|
92
|
+
border-radius: 4px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.chat_history_list {
|
|
79
96
|
overflow: auto;
|
|
80
97
|
max-height: 400px;
|
|
81
98
|
width: 300px;
|
|
@@ -83,12 +100,12 @@
|
|
|
83
100
|
font-size: 13px;
|
|
84
101
|
}
|
|
85
102
|
|
|
86
|
-
.
|
|
103
|
+
.chat_history_time {
|
|
87
104
|
opacity: 0.6;
|
|
88
105
|
padding-left: 4px;
|
|
89
106
|
}
|
|
90
107
|
|
|
91
|
-
.
|
|
108
|
+
.chat_history_item {
|
|
92
109
|
display: flex;
|
|
93
110
|
align-items: center;
|
|
94
111
|
justify-content: space-between;
|
|
@@ -97,7 +114,7 @@
|
|
|
97
114
|
margin-top: 2px;
|
|
98
115
|
border-radius: 3px;
|
|
99
116
|
|
|
100
|
-
.
|
|
117
|
+
.chat_history_item_content {
|
|
101
118
|
display: flex;
|
|
102
119
|
align-items: center;
|
|
103
120
|
width: 100%;
|
|
@@ -105,28 +122,28 @@
|
|
|
105
122
|
height: 24px;
|
|
106
123
|
}
|
|
107
124
|
|
|
108
|
-
.
|
|
125
|
+
.chat_history_item_title {
|
|
109
126
|
overflow: hidden;
|
|
110
127
|
text-overflow: ellipsis;
|
|
111
128
|
display: inline-block;
|
|
112
129
|
white-space: nowrap;
|
|
113
130
|
}
|
|
114
131
|
|
|
115
|
-
.
|
|
132
|
+
.chat_history_item_actions {
|
|
116
133
|
display: none;
|
|
117
134
|
}
|
|
118
135
|
|
|
119
|
-
.
|
|
136
|
+
.chat_history_item_selected {
|
|
120
137
|
background: var(--textPreformat-background);
|
|
121
138
|
}
|
|
122
139
|
|
|
123
140
|
&:hover {
|
|
124
141
|
background: var(--textPreformat-background);
|
|
125
142
|
|
|
126
|
-
.
|
|
143
|
+
.chat_history_item_actions {
|
|
127
144
|
display: block;
|
|
128
145
|
}
|
|
129
|
-
.
|
|
146
|
+
.chat_history_item_content {
|
|
130
147
|
max-width: calc(100% - 50px);
|
|
131
148
|
}
|
|
132
149
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
height: 100%;
|
|
5
5
|
.stop {
|
|
6
6
|
position: absolute;
|
|
7
|
-
bottom: -
|
|
7
|
+
bottom: -15px;
|
|
8
8
|
padding-top: 12px;
|
|
9
|
-
left: -
|
|
9
|
+
left: -9px;
|
|
10
10
|
width: 105%;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -453,7 +453,13 @@
|
|
|
453
453
|
h3,
|
|
454
454
|
h4,
|
|
455
455
|
h5 {
|
|
456
|
-
color:
|
|
456
|
+
color: var(--foreground);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
hr {
|
|
460
|
+
border-bottom: 0;
|
|
461
|
+
opacity: 0.3;
|
|
462
|
+
border-color: var(--descriptionForeground);
|
|
457
463
|
}
|
|
458
464
|
|
|
459
465
|
p {
|
|
@@ -519,6 +525,7 @@
|
|
|
519
525
|
display: flex;
|
|
520
526
|
font-size: 11px;
|
|
521
527
|
align-items: center;
|
|
528
|
+
min-width: 150px;
|
|
522
529
|
}
|
|
523
530
|
|
|
524
531
|
.mcp_desc {
|
|
@@ -565,3 +572,32 @@
|
|
|
565
572
|
color: var(--descriptionForeground);
|
|
566
573
|
}
|
|
567
574
|
}
|
|
575
|
+
|
|
576
|
+
.attachment {
|
|
577
|
+
display: inline-flex;
|
|
578
|
+
align-items: center;
|
|
579
|
+
padding: 0 4px;
|
|
580
|
+
margin: 0 2px;
|
|
581
|
+
background: var(--badge-background);
|
|
582
|
+
color: var(--badge-foreground);
|
|
583
|
+
border-radius: 3px;
|
|
584
|
+
vertical-align: middle;
|
|
585
|
+
font-size: 12px;
|
|
586
|
+
cursor: pointer;
|
|
587
|
+
:global {
|
|
588
|
+
.kt-icon {
|
|
589
|
+
font-size: 12px;
|
|
590
|
+
margin-right: 3px;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
&:hover {
|
|
594
|
+
background-color: var(--chat-slashCommandBackground);
|
|
595
|
+
color: var(--chat-slashCommandForeground);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.attachment_text {
|
|
600
|
+
line-height: 20px;
|
|
601
|
+
vertical-align: middle;
|
|
602
|
+
font-size: 12px;
|
|
603
|
+
}
|