@opensumi/ide-ai-native 3.9.1-next-1749181695.0 → 3.9.1-next-1749196667.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-core.contribution.d.ts.map +1 -1
- package/lib/browser/ai-core.contribution.js +4 -9
- package/lib/browser/ai-core.contribution.js.map +1 -1
- package/lib/browser/chat/apply.service.d.ts +0 -3
- package/lib/browser/chat/apply.service.d.ts.map +1 -1
- package/lib/browser/chat/apply.service.js +0 -47
- package/lib/browser/chat/apply.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +1 -3
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat-proxy.service.d.ts +2 -0
- package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-proxy.service.js +57 -50
- package/lib/browser/chat/chat-proxy.service.js.map +1 -1
- package/lib/browser/chat/chat.feature.registry.d.ts +1 -4
- package/lib/browser/chat/chat.feature.registry.d.ts.map +1 -1
- package/lib/browser/chat/chat.feature.registry.js +0 -6
- package/lib/browser/chat/chat.feature.registry.js.map +1 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +8 -33
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatEditor.js +2 -2
- 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 +1 -2
- package/lib/browser/components/ChatHistory.js.map +1 -1
- package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
- package/lib/browser/components/ChatMentionInput.js +30 -148
- package/lib/browser/components/ChatMentionInput.js.map +1 -1
- package/lib/browser/components/ChatReply.js +2 -2
- package/lib/browser/components/ChatReply.js.map +1 -1
- package/lib/browser/components/ChatToolRender.d.ts.map +1 -1
- package/lib/browser/components/ChatToolRender.js +2 -7
- package/lib/browser/components/ChatToolRender.js.map +1 -1
- package/lib/browser/components/ChatToolRender.module.less +0 -25
- package/lib/browser/components/components.module.less +8 -37
- package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
- package/lib/browser/components/mention-input/mention-input.js +14 -150
- package/lib/browser/components/mention-input/mention-input.js.map +1 -1
- package/lib/browser/components/mention-input/mention-input.module.less +1 -165
- package/lib/browser/components/mention-input/types.d.ts +1 -28
- package/lib/browser/components/mention-input/types.d.ts.map +1 -1
- package/lib/browser/components/mention-input/types.js +0 -1
- package/lib/browser/components/mention-input/types.js.map +1 -1
- package/lib/browser/components/utils.d.ts +2 -2
- package/lib/browser/context/llm-context.service.d.ts +2 -21
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js +20 -162
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/diff-computer.js +1 -1
- package/lib/browser/contrib/intelligent-completions/diff-computer.js.map +1 -1
- package/lib/browser/contrib/terminal/terminal.feature.registry.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -7
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/layout/ai-layout.d.ts.map +1 -1
- package/lib/browser/layout/ai-layout.js +4 -6
- package/lib/browser/layout/ai-layout.js.map +1 -1
- package/lib/browser/layout/tabbar.view.d.ts +1 -1
- package/lib/browser/layout/tabbar.view.d.ts.map +1 -1
- package/lib/browser/layout/tabbar.view.js +12 -5
- package/lib/browser/layout/tabbar.view.js.map +1 -1
- package/lib/browser/mcp/base-apply.service.d.ts +4 -5
- package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
- package/lib/browser/mcp/base-apply.service.js +5 -23
- package/lib/browser/mcp/base-apply.service.js.map +1 -1
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts +1 -3
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts.map +1 -1
- package/lib/browser/mcp/mcp-server-proxy.service.js +0 -4
- package/lib/browser/mcp/mcp-server-proxy.service.js.map +1 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
- package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/ListDir.js.map +1 -1
- package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
- package/lib/browser/preferences/schema.d.ts.map +1 -1
- package/lib/browser/preferences/schema.js +0 -5
- package/lib/browser/preferences/schema.js.map +1 -1
- package/lib/browser/types.d.ts +1 -8
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/types.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.component.js.map +1 -1
- package/lib/common/index.d.ts +1 -5
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +0 -2
- package/lib/common/index.js.map +1 -1
- package/lib/common/llm-context.d.ts +0 -19
- package/lib/common/llm-context.d.ts.map +1 -1
- package/lib/common/llm-context.js.map +1 -1
- package/lib/common/model.d.ts +0 -1
- package/lib/common/model.d.ts.map +1 -1
- package/lib/common/model.js.map +1 -1
- package/lib/common/prompts/context-prompt-provider.d.ts +2 -0
- package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
- package/lib/common/prompts/context-prompt-provider.js +29 -35
- package/lib/common/prompts/context-prompt-provider.js.map +1 -1
- package/lib/common/types.d.ts +0 -21
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js.map +1 -1
- package/lib/common/utils.d.ts +0 -1
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +2 -5
- package/lib/common/utils.js.map +1 -1
- package/lib/node/anthropic/anthropic-language-model.d.ts +1 -1
- package/lib/node/base-language-model.d.ts +1 -2
- package/lib/node/base-language-model.d.ts.map +1 -1
- package/lib/node/base-language-model.js +2 -12
- package/lib/node/base-language-model.js.map +1 -1
- package/lib/node/deepseek/deepseek-language-model.d.ts +1 -1
- package/lib/node/mcp/sumi-mcp-server.d.ts +1 -3
- package/lib/node/mcp/sumi-mcp-server.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.js +1 -7
- package/lib/node/mcp/sumi-mcp-server.js.map +1 -1
- package/lib/node/mcp-server-manager-impl.d.ts +1 -3
- package/lib/node/mcp-server-manager-impl.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-impl.js +2 -14
- package/lib/node/mcp-server-manager-impl.js.map +1 -1
- package/package.json +25 -26
- package/src/browser/ai-core.contribution.ts +4 -14
- package/src/browser/chat/apply.service.ts +1 -62
- package/src/browser/chat/chat-model.ts +1 -3
- package/src/browser/chat/chat-proxy.service.ts +81 -68
- package/src/browser/chat/chat.feature.registry.ts +1 -17
- package/src/browser/chat/chat.view.tsx +10 -40
- package/src/browser/components/ChatEditor.tsx +1 -1
- package/src/browser/components/ChatHistory.tsx +1 -2
- package/src/browser/components/ChatMentionInput.tsx +35 -180
- package/src/browser/components/ChatReply.tsx +4 -4
- package/src/browser/components/ChatToolRender.module.less +0 -25
- package/src/browser/components/ChatToolRender.tsx +2 -10
- package/src/browser/components/components.module.less +8 -37
- package/src/browser/components/mention-input/mention-input.module.less +1 -165
- package/src/browser/components/mention-input/mention-input.tsx +31 -232
- package/src/browser/components/mention-input/types.ts +0 -29
- package/src/browser/context/llm-context.service.ts +21 -182
- package/src/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.ts +1 -1
- package/src/browser/contrib/intelligent-completions/diff-computer.ts +1 -1
- package/src/browser/contrib/terminal/terminal.feature.registry.ts +1 -1
- package/src/browser/index.ts +0 -8
- package/src/browser/layout/ai-layout.tsx +8 -12
- package/src/browser/layout/tabbar.view.tsx +23 -10
- package/src/browser/mcp/base-apply.service.ts +10 -30
- package/src/browser/mcp/mcp-server-proxy.service.ts +1 -6
- package/src/browser/mcp/tools/getDiagnosticsByPath.ts +1 -1
- package/src/browser/mcp/tools/getOpenEditorFileDiagnostics.ts +1 -1
- package/src/browser/mcp/tools/handlers/ListDir.ts +1 -1
- package/src/browser/mcp/tools/runTerminalCmd.ts +1 -1
- package/src/browser/preferences/schema.ts +0 -5
- package/src/browser/types.ts +0 -12
- package/src/browser/widget/inline-stream-diff/live-preview.component.tsx +1 -0
- package/src/common/index.ts +1 -6
- package/src/common/llm-context.ts +0 -23
- package/src/common/model.ts +0 -1
- package/src/common/prompts/context-prompt-provider.ts +40 -55
- package/src/common/types.ts +0 -18
- package/src/common/utils.ts +1 -4
- package/src/node/base-language-model.ts +14 -11
- package/src/node/mcp/sumi-mcp-server.ts +2 -10
- package/src/node/mcp-server-manager-impl.ts +2 -17
- package/lib/browser/components/mention-input/mention-select.d.ts +0 -28
- package/lib/browser/components/mention-input/mention-select.d.ts.map +0 -1
- package/lib/browser/components/mention-input/mention-select.js +0 -136
- package/lib/browser/components/mention-input/mention-select.js.map +0 -1
- package/lib/browser/components/mention-input/mention-select.module.less +0 -297
- package/lib/browser/rules/rules.contribution.d.ts +0 -29
- package/lib/browser/rules/rules.contribution.d.ts.map +0 -1
- package/lib/browser/rules/rules.contribution.js +0 -94
- package/lib/browser/rules/rules.contribution.js.map +0 -1
- package/lib/browser/rules/rules.module.less +0 -175
- package/lib/browser/rules/rules.service.d.ts +0 -25
- package/lib/browser/rules/rules.service.d.ts.map +0 -1
- package/lib/browser/rules/rules.service.js +0 -180
- package/lib/browser/rules/rules.service.js.map +0 -1
- package/lib/browser/rules/rules.view.d.ts +0 -3
- package/lib/browser/rules/rules.view.d.ts.map +0 -1
- package/lib/browser/rules/rules.view.js +0 -76
- package/lib/browser/rules/rules.view.js.map +0 -1
- package/lib/common/image-compression.d.ts +0 -25
- package/lib/common/image-compression.d.ts.map +0 -1
- package/lib/common/image-compression.js +0 -153
- package/lib/common/image-compression.js.map +0 -1
- package/lib/common/mdc-parser.d.ts +0 -60
- package/lib/common/mdc-parser.d.ts.map +0 -1
- package/lib/common/mdc-parser.js +0 -246
- package/lib/common/mdc-parser.js.map +0 -1
- package/lib/common/prompts/system-prompt.d.ts +0 -2
- package/lib/common/prompts/system-prompt.d.ts.map +0 -1
- package/lib/common/prompts/system-prompt.js +0 -5
- package/lib/common/prompts/system-prompt.js.map +0 -1
- package/src/browser/components/mention-input/mention-select.module.less +0 -297
- package/src/browser/components/mention-input/mention-select.tsx +0 -256
- package/src/browser/rules/rules.contribution.ts +0 -105
- package/src/browser/rules/rules.module.less +0 -175
- package/src/browser/rules/rules.service.ts +0 -189
- package/src/browser/rules/rules.view.tsx +0 -127
- package/src/common/image-compression.ts +0 -174
- package/src/common/mdc-parser.ts +0 -295
- package/src/common/prompts/system-prompt.ts +0 -2
|
@@ -617,12 +617,7 @@ export const AIChatView = () => {
|
|
|
617
617
|
const { message, images, agentId, command, reportExtra } = value;
|
|
618
618
|
const { actionType, actionSource } = reportExtra || {};
|
|
619
619
|
|
|
620
|
-
const request = aiChatService.createRequest(
|
|
621
|
-
message.replaceAll(LLM_CONTEXT_KEY_REGEX, ''),
|
|
622
|
-
agentId!,
|
|
623
|
-
images,
|
|
624
|
-
command,
|
|
625
|
-
);
|
|
620
|
+
const request = aiChatService.createRequest(message, agentId!, images, command);
|
|
626
621
|
if (!request) {
|
|
627
622
|
return;
|
|
628
623
|
}
|
|
@@ -646,7 +641,7 @@ export const AIChatView = () => {
|
|
|
646
641
|
600 * 1000,
|
|
647
642
|
);
|
|
648
643
|
msgHistoryManager.addUserMessage({
|
|
649
|
-
content: message,
|
|
644
|
+
content: message.replaceAll(LLM_CONTEXT_KEY_REGEX, ''),
|
|
650
645
|
images: images || [],
|
|
651
646
|
agentId: agentId!,
|
|
652
647
|
agentCommand: command!,
|
|
@@ -700,9 +695,14 @@ export const AIChatView = () => {
|
|
|
700
695
|
let processedContent = message;
|
|
701
696
|
const filePattern = /\{\{@file:(.*?)\}\}/g;
|
|
702
697
|
const fileMatches = message.match(filePattern);
|
|
698
|
+
let isCleanContext = false;
|
|
703
699
|
if (fileMatches) {
|
|
704
700
|
for (const match of fileMatches) {
|
|
705
701
|
const filePath = match.replace(/\{\{@file:(.*?)\}\}/, '$1');
|
|
702
|
+
if (filePath && !isCleanContext) {
|
|
703
|
+
isCleanContext = true;
|
|
704
|
+
llmContextService.cleanFileContext();
|
|
705
|
+
}
|
|
706
706
|
const fileUri = new URI(filePath);
|
|
707
707
|
const relativePath = (await workspaceService.asRelativePath(fileUri))?.path || fileUri.displayName;
|
|
708
708
|
processedContent = processedContent.replace(match, `\`${LLM_CONTEXT_KEY.AttachedFile}${relativePath}\``);
|
|
@@ -738,18 +738,6 @@ export const AIChatView = () => {
|
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const rulePattern = /\{\{@rule:(.*?)\}\}/g;
|
|
742
|
-
const ruleMatches = processedContent.match(rulePattern);
|
|
743
|
-
if (ruleMatches) {
|
|
744
|
-
for (const match of ruleMatches) {
|
|
745
|
-
const ruleName = match.replace(/\{\{@rule:(.*?)\}\}/, '$1');
|
|
746
|
-
const ruleUri = new URI(ruleName);
|
|
747
|
-
processedContent = processedContent.replace(
|
|
748
|
-
match,
|
|
749
|
-
`\`${LLM_CONTEXT_KEY.AttachedFile}${ruleUri.displayName}\``,
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
741
|
return handleAgentReply({ message: processedContent, images, agentId, command, reportExtra });
|
|
754
742
|
},
|
|
755
743
|
[handleAgentReply],
|
|
@@ -930,7 +918,6 @@ export function DefaultChatViewHeader({
|
|
|
930
918
|
}) {
|
|
931
919
|
const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
|
|
932
920
|
const messageService = useInjectable<IMessageService>(IMessageService);
|
|
933
|
-
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
934
921
|
|
|
935
922
|
const [historyList, setHistoryList] = React.useState<IChatHistoryItem[]>([]);
|
|
936
923
|
const [currentTitle, setCurrentTitle] = React.useState<string>('');
|
|
@@ -960,26 +947,9 @@ export function DefaultChatViewHeader({
|
|
|
960
947
|
const getHistoryList = () => {
|
|
961
948
|
const currentMessages = aiChatService.sessionModel.history.getMessages();
|
|
962
949
|
const latestUserMessage = currentMessages.findLast((m) => m.role === ChatMessageRole.User);
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
: '';
|
|
967
|
-
const messages = aiChatService.sessionModel.history.getMessages().map((msg) => ({
|
|
968
|
-
role: msg.role,
|
|
969
|
-
content: msg.content,
|
|
970
|
-
}));
|
|
971
|
-
if (messages.length > 2 && summaryProvider && aiChatService.sessionModel.sessionId) {
|
|
972
|
-
summaryProvider.getMessageSummary(messages).then((summary) => {
|
|
973
|
-
if (summary) {
|
|
974
|
-
setCurrentTitle(summary.slice(0, MAX_TITLE_LENGTH));
|
|
975
|
-
} else {
|
|
976
|
-
setCurrentTitle(currentTitle);
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
} else {
|
|
980
|
-
setCurrentTitle(currentTitle);
|
|
981
|
-
}
|
|
982
|
-
|
|
950
|
+
setCurrentTitle(
|
|
951
|
+
latestUserMessage ? cleanAttachedTextWrapper(latestUserMessage.content).slice(0, MAX_TITLE_LENGTH) : '',
|
|
952
|
+
);
|
|
983
953
|
setHistoryList(
|
|
984
954
|
aiChatService.getSessions().map((session) => {
|
|
985
955
|
const history = session.history;
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
localize,
|
|
26
26
|
runWhenIdle,
|
|
27
27
|
} from '@opensumi/ide-core-common';
|
|
28
|
-
import { insertSnippetWithMonacoEditor } from '@opensumi/ide-editor/lib/browser/editor-
|
|
28
|
+
import { insertSnippetWithMonacoEditor } from '@opensumi/ide-editor/lib/browser/base-editor-wrapper';
|
|
29
29
|
import { MonacoCommandRegistry } from '@opensumi/ide-editor/lib/browser/monaco-contrib/command/command.service';
|
|
30
30
|
import { ITheme, IThemeService } from '@opensumi/ide-theme';
|
|
31
31
|
import { WorkbenchThemeService } from '@opensumi/ide-theme/lib/browser/workbench.theme.service';
|
|
@@ -216,8 +216,7 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
|
|
|
216
216
|
// 渲染历史记录列表
|
|
217
217
|
const renderHistory = useCallback(() => {
|
|
218
218
|
const filteredList = historyList
|
|
219
|
-
.slice(
|
|
220
|
-
.reverse()
|
|
219
|
+
.slice(0, MAX_HISTORY_LIST)
|
|
221
220
|
.filter((item) => item.title && item.title.includes(searchValue));
|
|
222
221
|
|
|
223
222
|
const groupedHistoryList = formatHistory(filteredList);
|
|
@@ -10,13 +10,7 @@ import {
|
|
|
10
10
|
useInjectable,
|
|
11
11
|
} from '@opensumi/ide-core-browser';
|
|
12
12
|
import { Icon, getIcon } from '@opensumi/ide-core-browser/lib/components';
|
|
13
|
-
import {
|
|
14
|
-
AINativeSettingSectionsId,
|
|
15
|
-
ChatFeatureRegistryToken,
|
|
16
|
-
RulesServiceToken,
|
|
17
|
-
URI,
|
|
18
|
-
localize,
|
|
19
|
-
} from '@opensumi/ide-core-common';
|
|
13
|
+
import { AINativeSettingSectionsId, ChatFeatureRegistryToken, URI, localize } from '@opensumi/ide-core-common';
|
|
20
14
|
import { CommandService } from '@opensumi/ide-core-common/lib/command';
|
|
21
15
|
import { defaultFilesWatcherExcludes } from '@opensumi/ide-core-common/lib/preferences/file-watch';
|
|
22
16
|
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
@@ -24,8 +18,6 @@ import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-se
|
|
|
24
18
|
import { OutlineCompositeTreeNode, OutlineTreeNode } from '@opensumi/ide-outline/lib/browser/outline-node.define';
|
|
25
19
|
import { OutlineTreeService } from '@opensumi/ide-outline/lib/browser/services/outline-tree.service';
|
|
26
20
|
import { IMessageService } from '@opensumi/ide-overlay';
|
|
27
|
-
import { IconType } from '@opensumi/ide-theme';
|
|
28
|
-
import { IconService } from '@opensumi/ide-theme/lib/browser';
|
|
29
21
|
import { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
30
22
|
|
|
31
23
|
import { IChatInternalService } from '../../common';
|
|
@@ -33,8 +25,6 @@ import { LLMContextService } from '../../common/llm-context';
|
|
|
33
25
|
import { ChatFeatureRegistry } from '../chat/chat.feature.registry';
|
|
34
26
|
import { ChatInternalService } from '../chat/chat.internal.service';
|
|
35
27
|
import { MCPConfigCommands } from '../mcp/config/mcp-config.commands';
|
|
36
|
-
import { RulesCommands } from '../rules/rules.contribution';
|
|
37
|
-
import { RulesService } from '../rules/rules.service';
|
|
38
28
|
|
|
39
29
|
import styles from './components.module.less';
|
|
40
30
|
import { MentionInput } from './mention-input/mention-input';
|
|
@@ -82,21 +72,15 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
82
72
|
const workspaceService = useInjectable<IWorkspaceService>(IWorkspaceService);
|
|
83
73
|
const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
|
|
84
74
|
const labelService = useInjectable<LabelService>(LabelService);
|
|
85
|
-
const iconService = useInjectable<IconService>(IconService);
|
|
86
75
|
const messageService = useInjectable<IMessageService>(IMessageService);
|
|
87
76
|
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
88
77
|
const outlineTreeService = useInjectable<OutlineTreeService>(OutlineTreeService);
|
|
89
78
|
const prevOutlineItems = useRef<MentionItem[]>([]);
|
|
90
79
|
const preferenceService = useInjectable<PreferenceService>(PreferenceService);
|
|
91
|
-
const rulesService = useInjectable<RulesService>(RulesServiceToken);
|
|
92
80
|
const handleShowMCPConfig = React.useCallback(() => {
|
|
93
81
|
commandService.executeCommand(MCPConfigCommands.OPEN_MCP_CONFIG.id);
|
|
94
82
|
}, [commandService]);
|
|
95
83
|
|
|
96
|
-
const handleShowRules = React.useCallback(() => {
|
|
97
|
-
commandService.executeCommand(RulesCommands.OPEN_RULES_FILE.id);
|
|
98
|
-
}, [commandService]);
|
|
99
|
-
|
|
100
84
|
useEffect(() => {
|
|
101
85
|
if (props.value !== value) {
|
|
102
86
|
setValue(props.value || '');
|
|
@@ -123,55 +107,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
123
107
|
[outlineTreeService],
|
|
124
108
|
);
|
|
125
109
|
|
|
126
|
-
// 拆分目录路径为多个层级的辅助函数
|
|
127
|
-
const expandFolderPaths = async (folderPaths: string[], workspaceRootPath: string): Promise<MentionItem[]> => {
|
|
128
|
-
const expandedPaths = new Set<string>();
|
|
129
|
-
const workspaceUri = new URI(workspaceRootPath);
|
|
130
|
-
|
|
131
|
-
// 将所有路径展开为多层级
|
|
132
|
-
for (const folderPath of folderPaths) {
|
|
133
|
-
const uri = new URI(folderPath);
|
|
134
|
-
const relativePath = await workspaceService.asRelativePath(uri);
|
|
135
|
-
|
|
136
|
-
if (relativePath?.path) {
|
|
137
|
-
const pathSegments = relativePath.path.split('/').filter(Boolean);
|
|
138
|
-
|
|
139
|
-
// 为每个层级创建路径
|
|
140
|
-
for (let i = 0; i < pathSegments.length; i++) {
|
|
141
|
-
const segmentPath = pathSegments.slice(0, i + 1).join('/');
|
|
142
|
-
const fullPath = workspaceUri.resolve(segmentPath).codeUri.fsPath;
|
|
143
|
-
|
|
144
|
-
// 避免添加工作区本身或其上级目录
|
|
145
|
-
if (fullPath !== workspaceRootPath && !workspaceRootPath.startsWith(fullPath)) {
|
|
146
|
-
expandedPaths.add(fullPath);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
} else {
|
|
150
|
-
// 如果无法获取相对路径,直接添加(但仍要过滤工作区路径)
|
|
151
|
-
if (folderPath !== workspaceRootPath && !workspaceRootPath.startsWith(folderPath)) {
|
|
152
|
-
expandedPaths.add(folderPath);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 转换为 MentionItem 格式
|
|
158
|
-
return Promise.all(
|
|
159
|
-
Array.from(expandedPaths).map(async (folderPath) => {
|
|
160
|
-
const uri = new URI(folderPath);
|
|
161
|
-
const relativePath = await workspaceService.asRelativePath(uri);
|
|
162
|
-
return {
|
|
163
|
-
id: uri.codeUri.fsPath,
|
|
164
|
-
type: MentionType.FOLDER,
|
|
165
|
-
text: uri.displayName,
|
|
166
|
-
value: uri.codeUri.fsPath,
|
|
167
|
-
description: relativePath?.root ? relativePath.path : '',
|
|
168
|
-
contextId: uri.codeUri.fsPath,
|
|
169
|
-
icon: getIcon('folder'),
|
|
170
|
-
};
|
|
171
|
-
}),
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
110
|
// 默认菜单项
|
|
176
111
|
const defaultMenuItems: MentionItem[] = [
|
|
177
112
|
{
|
|
@@ -279,7 +214,21 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
279
214
|
.filter((folder) => folder !== workspaceService.workspace?.uri.toString() && folder !== '/'),
|
|
280
215
|
),
|
|
281
216
|
);
|
|
282
|
-
folders = await
|
|
217
|
+
folders = await Promise.all(
|
|
218
|
+
recentFolder.map(async (folder) => {
|
|
219
|
+
const uri = new URI(folder);
|
|
220
|
+
const relativePath = await workspaceService.asRelativePath(uri);
|
|
221
|
+
return {
|
|
222
|
+
id: uri.codeUri.fsPath,
|
|
223
|
+
type: MentionType.FOLDER,
|
|
224
|
+
text: uri.displayName,
|
|
225
|
+
value: uri.codeUri.fsPath,
|
|
226
|
+
description: relativePath?.root ? relativePath.path : '',
|
|
227
|
+
contextId: uri.codeUri.fsPath,
|
|
228
|
+
icon: getIcon('folder'),
|
|
229
|
+
};
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
283
232
|
} else {
|
|
284
233
|
const rootUris = (await workspaceService.roots).map((root) => new URI(root.uri).codeUri.fsPath.toString());
|
|
285
234
|
const files = await searchService.find(searchText, {
|
|
@@ -297,11 +246,22 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
297
246
|
.filter((folder) => folder !== workspaceService.workspace?.uri.toString()),
|
|
298
247
|
),
|
|
299
248
|
);
|
|
300
|
-
return
|
|
249
|
+
return Promise.all(
|
|
250
|
+
folders.map(async (folder) => {
|
|
251
|
+
const uri = new URI(folder);
|
|
252
|
+
return {
|
|
253
|
+
id: uri.codeUri.fsPath,
|
|
254
|
+
type: MentionType.FOLDER,
|
|
255
|
+
text: uri.displayName,
|
|
256
|
+
value: uri.codeUri.fsPath,
|
|
257
|
+
description: (await workspaceService.asRelativePath(uri.parent))?.path || '',
|
|
258
|
+
contextId: uri.codeUri.fsPath,
|
|
259
|
+
icon: getIcon('folder'),
|
|
260
|
+
};
|
|
261
|
+
}),
|
|
262
|
+
);
|
|
301
263
|
}
|
|
302
|
-
return folders
|
|
303
|
-
.filter(Boolean)
|
|
304
|
-
.filter((folder) => folder.id !== new URI(workspaceService.workspace?.uri).codeUri.fsPath);
|
|
264
|
+
return folders.filter((folder) => folder.id !== new URI(workspaceService.workspace?.uri).codeUri.fsPath);
|
|
305
265
|
},
|
|
306
266
|
},
|
|
307
267
|
{
|
|
@@ -352,111 +312,13 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
352
312
|
}
|
|
353
313
|
},
|
|
354
314
|
},
|
|
355
|
-
{
|
|
356
|
-
id: MentionType.RULE,
|
|
357
|
-
type: MentionType.RULE,
|
|
358
|
-
text: 'Rule',
|
|
359
|
-
icon: getIcon('rules'),
|
|
360
|
-
getHighestLevelItems: () => [],
|
|
361
|
-
getItems: async (searchText: string) => {
|
|
362
|
-
const rules = await rulesService.projectRules;
|
|
363
|
-
const mappedRules = rules.map((rule) => {
|
|
364
|
-
const uri = new URI(rule.path);
|
|
365
|
-
return {
|
|
366
|
-
id: uri.codeUri.fsPath,
|
|
367
|
-
type: MentionType.RULE,
|
|
368
|
-
text: uri.displayName,
|
|
369
|
-
value: uri.codeUri.fsPath,
|
|
370
|
-
contextId: uri.codeUri.fsPath,
|
|
371
|
-
description: rule.description,
|
|
372
|
-
icon: getIcon('rules'),
|
|
373
|
-
};
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
if (!searchText) {
|
|
377
|
-
return mappedRules.slice(0, 10);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
const lowerSearchText = searchText.toLocaleLowerCase();
|
|
381
|
-
return mappedRules
|
|
382
|
-
.filter((rule) => rule.text.toLocaleLowerCase().includes(lowerSearchText))
|
|
383
|
-
.sort((a, b) => {
|
|
384
|
-
const aTextLower = a.text.toLocaleLowerCase();
|
|
385
|
-
const bTextLower = b.text.toLocaleLowerCase();
|
|
386
|
-
const aDescLower = a.description?.toLocaleLowerCase() || '';
|
|
387
|
-
const bDescLower = b.description?.toLocaleLowerCase() || '';
|
|
388
|
-
|
|
389
|
-
// 优先级:文件名包含搜索文本 > 描述包含搜索文本
|
|
390
|
-
const aTextMatch = aTextLower.includes(lowerSearchText);
|
|
391
|
-
const bTextMatch = bTextLower.includes(lowerSearchText);
|
|
392
|
-
const aDescMatch = aDescLower.includes(lowerSearchText);
|
|
393
|
-
const bDescMatch = bDescLower.includes(lowerSearchText);
|
|
394
|
-
|
|
395
|
-
if (aTextMatch && bTextMatch) {
|
|
396
|
-
// 如果都匹配文件名,按文件名字母序排序
|
|
397
|
-
return aTextLower.localeCompare(bTextLower);
|
|
398
|
-
}
|
|
399
|
-
if (aTextMatch && !bTextMatch) {
|
|
400
|
-
return -1;
|
|
401
|
-
}
|
|
402
|
-
if (!aTextMatch && bTextMatch) {
|
|
403
|
-
return 1;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// 如果文件名都不匹配,比较描述
|
|
407
|
-
if (aDescMatch && bDescMatch) {
|
|
408
|
-
return aTextLower.localeCompare(bTextLower);
|
|
409
|
-
}
|
|
410
|
-
if (aDescMatch && !bDescMatch) {
|
|
411
|
-
return -1;
|
|
412
|
-
}
|
|
413
|
-
if (!aDescMatch && bDescMatch) {
|
|
414
|
-
return 1;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// 如果都不匹配,按文件名字母序排序
|
|
418
|
-
return aTextLower.localeCompare(bTextLower);
|
|
419
|
-
})
|
|
420
|
-
.slice(0, 10);
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
315
|
];
|
|
316
|
+
|
|
424
317
|
const defaultMentionInputFooterOptions: FooterConfig = useMemo(
|
|
425
318
|
() => ({
|
|
426
319
|
modelOptions: [
|
|
427
|
-
{
|
|
428
|
-
|
|
429
|
-
label: 'Qwen 3',
|
|
430
|
-
iconClass: iconService.fromIcon(
|
|
431
|
-
'',
|
|
432
|
-
'https://img.alicdn.com/imgextra/i3/O1CN01LFMrZj28YrnrzeebY_!!6000000007945-55-tps-16-16.svg',
|
|
433
|
-
IconType.Background,
|
|
434
|
-
),
|
|
435
|
-
tags: ['思考链', '擅长代码'],
|
|
436
|
-
description: '高性能代码模型,支持思考链',
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
label: 'Claude 4 Sonnet',
|
|
440
|
-
value: 'claude_sonnet4',
|
|
441
|
-
iconClass: iconService.fromIcon(
|
|
442
|
-
'',
|
|
443
|
-
'https://img.alicdn.com/imgextra/i3/O1CN01p0mziz1Nsl40lp1HO_!!6000000001626-55-tps-92-65.svg',
|
|
444
|
-
IconType.Background,
|
|
445
|
-
),
|
|
446
|
-
tags: ['多模态', '长上下文理解', '思考模式'],
|
|
447
|
-
description: '高性能模型,支持多模态输入',
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
label: 'DeepSeek R1',
|
|
451
|
-
value: 'DeepSeek-R1-0528',
|
|
452
|
-
iconClass: iconService.fromIcon(
|
|
453
|
-
'',
|
|
454
|
-
'https://img.alicdn.com/imgextra/i3/O1CN01ClcK2w1JwdxcbAB3a_!!6000000001093-55-tps-30-30.svg',
|
|
455
|
-
IconType.Background,
|
|
456
|
-
),
|
|
457
|
-
tags: ['思考模式', '长上下文理解'],
|
|
458
|
-
description: '专业创作,支持多模态输入',
|
|
459
|
-
},
|
|
320
|
+
{ label: 'QWQ 32B', value: 'qwq-32b' },
|
|
321
|
+
{ label: 'DeepSeek R1', value: 'deepseek-r1' },
|
|
460
322
|
],
|
|
461
323
|
defaultModel:
|
|
462
324
|
props.sessionModelId || preferenceService.get<string>(AINativeSettingSectionsId.ModelID) || 'deepseek-r1',
|
|
@@ -468,13 +330,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
468
330
|
onClick: handleShowMCPConfig,
|
|
469
331
|
position: FooterButtonPosition.LEFT,
|
|
470
332
|
},
|
|
471
|
-
{
|
|
472
|
-
id: 'rules',
|
|
473
|
-
icon: 'rules',
|
|
474
|
-
title: 'Rules',
|
|
475
|
-
onClick: handleShowRules,
|
|
476
|
-
position: FooterButtonPosition.LEFT,
|
|
477
|
-
},
|
|
478
333
|
{
|
|
479
334
|
id: 'upload-image',
|
|
480
335
|
icon: 'image',
|
|
@@ -497,7 +352,7 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
|
|
|
497
352
|
showModelSelector: true,
|
|
498
353
|
disableModelSelector: props.disableModelSelector,
|
|
499
354
|
}),
|
|
500
|
-
[
|
|
355
|
+
[handleShowMCPConfig, props.disableModelSelector, props.sessionModelId],
|
|
501
356
|
);
|
|
502
357
|
|
|
503
358
|
const handleStop = useCallback(() => {
|
|
@@ -342,10 +342,10 @@ export const ChatReply = (props: IChatReplyProps) => {
|
|
|
342
342
|
}}
|
|
343
343
|
>
|
|
344
344
|
<Icon iconClass='codicon codicon-sparkle' />
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
{localize('aiNative.chat.thinking')}
|
|
346
|
+
{isThinking ? (
|
|
347
|
+
<Loading />
|
|
348
|
+
) : collapseThinkingIndexSet.has(index) ? (
|
|
349
349
|
<Icon iconClass='codicon codicon-chevron-right' />
|
|
350
350
|
) : (
|
|
351
351
|
<Icon iconClass='codicon codicon-chevron-down' />
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
display: flex;
|
|
24
24
|
align-items: center;
|
|
25
25
|
font-weight: 500;
|
|
26
|
-
width: calc(100% - 20px);
|
|
27
26
|
color: var(--design-text-foreground);
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -35,30 +34,6 @@
|
|
|
35
34
|
margin-left: 5px;
|
|
36
35
|
font-size: 11px;
|
|
37
36
|
color: var(--descriptionForeground);
|
|
38
|
-
width: calc(100% - 36px);
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: flex-start;
|
|
42
|
-
|
|
43
|
-
.tool_prefix {
|
|
44
|
-
color: var(--design-text-placeholderForeground);
|
|
45
|
-
margin-right: 10px;
|
|
46
|
-
flex-shrink: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.tool_name {
|
|
50
|
-
opacity: 0.8;
|
|
51
|
-
font-size: 9px;
|
|
52
|
-
flex: 1;
|
|
53
|
-
text-overflow: ellipsis;
|
|
54
|
-
direction: rtl;
|
|
55
|
-
unicode-bidi: plaintext;
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
white-space: nowrap;
|
|
58
|
-
display: inline-block;
|
|
59
|
-
margin-right: 10px;
|
|
60
|
-
text-align: left;
|
|
61
|
-
}
|
|
62
37
|
}
|
|
63
38
|
|
|
64
39
|
.expand_icon {
|
|
@@ -7,7 +7,6 @@ import { Loading } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
|
7
7
|
import { IChatToolContent, uuid } from '@opensumi/ide-core-common';
|
|
8
8
|
import { localize } from '@opensumi/ide-core-common/lib/localize';
|
|
9
9
|
|
|
10
|
-
import { TOOL_NAME_SEPARATOR } from '../../common/utils';
|
|
11
10
|
import { IMCPServerRegistry, TokenMCPServerRegistry } from '../types';
|
|
12
11
|
|
|
13
12
|
import { CodeEditorWithHighlight } from './ChatEditor';
|
|
@@ -22,9 +21,7 @@ export const ChatToolRender = (props: { value: IChatToolContent['content']; mess
|
|
|
22
21
|
if (!value || !value.function || !value.id) {
|
|
23
22
|
return null;
|
|
24
23
|
}
|
|
25
|
-
const
|
|
26
|
-
const parts = toolName.split(TOOL_NAME_SEPARATOR);
|
|
27
|
-
const label = parts.length >= 3 ? parts[2] : toolName;
|
|
24
|
+
const label = mcpServerFeatureRegistry.getMCPTool(value.function.name)?.label || value.function.name;
|
|
28
25
|
|
|
29
26
|
const ToolComponent = mcpServerFeatureRegistry.getToolComponent(value.function.name);
|
|
30
27
|
|
|
@@ -75,12 +72,7 @@ export const ChatToolRender = (props: { value: IChatToolContent['content']; mess
|
|
|
75
72
|
<div className={styles.tool_name}>
|
|
76
73
|
<Icon iconClass={`codicon codicon-chevron-${isExpanded ? 'down' : 'right'}`} />
|
|
77
74
|
<Icon size='small' iconClass={cls('codicon codicon-tools', styles.tool_icon)} />
|
|
78
|
-
<span className={styles.tool_label}>
|
|
79
|
-
<span className={styles.tool_prefix}>Called MCP Tool</span>
|
|
80
|
-
<span className={styles.tool_name} title={label}>
|
|
81
|
-
{label}
|
|
82
|
-
</span>
|
|
83
|
-
</span>
|
|
75
|
+
<span className={styles.tool_label}>{label}</span>
|
|
84
76
|
</div>
|
|
85
77
|
{value.state && (
|
|
86
78
|
<div className={styles.tool_state}>
|
|
@@ -524,6 +524,7 @@
|
|
|
524
524
|
display: flex;
|
|
525
525
|
font-size: 11px;
|
|
526
526
|
align-items: center;
|
|
527
|
+
min-width: 150px;
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
.mcp_desc {
|
|
@@ -584,6 +585,7 @@
|
|
|
584
585
|
.reasoning_content {
|
|
585
586
|
padding: 8px 12px;
|
|
586
587
|
margin-top: 4px;
|
|
588
|
+
border-left: 2px solid var(--descriptionForeground);
|
|
587
589
|
color: var(--descriptionForeground);
|
|
588
590
|
background: var(--design-block-background);
|
|
589
591
|
border-radius: 4px;
|
|
@@ -595,8 +597,8 @@
|
|
|
595
597
|
align-items: center;
|
|
596
598
|
padding: 0 4px;
|
|
597
599
|
margin: 0 2px;
|
|
598
|
-
background
|
|
599
|
-
color: var(--
|
|
600
|
+
background: var(--badge-background);
|
|
601
|
+
color: var(--badge-foreground);
|
|
600
602
|
border-radius: 3px;
|
|
601
603
|
vertical-align: middle;
|
|
602
604
|
font-size: 12px;
|
|
@@ -607,6 +609,10 @@
|
|
|
607
609
|
margin-right: 3px;
|
|
608
610
|
}
|
|
609
611
|
}
|
|
612
|
+
&:hover {
|
|
613
|
+
background-color: var(--chat-slashCommandBackground);
|
|
614
|
+
color: var(--chat-slashCommandForeground);
|
|
615
|
+
}
|
|
610
616
|
}
|
|
611
617
|
|
|
612
618
|
.attachment_text {
|
|
@@ -614,13 +620,6 @@
|
|
|
614
620
|
vertical-align: middle;
|
|
615
621
|
font-size: 12px;
|
|
616
622
|
word-break: break-all;
|
|
617
|
-
max-width: 100px;
|
|
618
|
-
text-overflow: ellipsis;
|
|
619
|
-
direction: rtl;
|
|
620
|
-
unicode-bidi: plaintext;
|
|
621
|
-
overflow: hidden;
|
|
622
|
-
white-space: nowrap;
|
|
623
|
-
display: inline-block;
|
|
624
623
|
}
|
|
625
624
|
|
|
626
625
|
.thumbnail_container {
|
|
@@ -673,31 +672,3 @@
|
|
|
673
672
|
border-radius: 3px;
|
|
674
673
|
overflow: hidden;
|
|
675
674
|
}
|
|
676
|
-
|
|
677
|
-
.shiny_text {
|
|
678
|
-
color: #b5b5b5a4; /* Adjust this color to change intensity/style */
|
|
679
|
-
background: linear-gradient(
|
|
680
|
-
120deg,
|
|
681
|
-
rgba(255, 255, 255, 0) 40%,
|
|
682
|
-
rgba(255, 255, 255, 0.8) 50%,
|
|
683
|
-
rgba(255, 255, 255, 0) 60%
|
|
684
|
-
);
|
|
685
|
-
background-size: 200% 100%;
|
|
686
|
-
-webkit-background-clip: text;
|
|
687
|
-
background-clip: text;
|
|
688
|
-
display: inline-block;
|
|
689
|
-
animation: shine 5s linear infinite;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
@keyframes shine {
|
|
693
|
-
0% {
|
|
694
|
-
background-position: 100%;
|
|
695
|
-
}
|
|
696
|
-
100% {
|
|
697
|
-
background-position: -100%;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.shiny_text.disabled {
|
|
702
|
-
animation: none;
|
|
703
|
-
}
|