@opensumi/ide-ai-native 3.8.3-next-1741745665.0 → 3.8.3-next-1741752385.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.
Files changed (171) hide show
  1. package/lib/browser/chat/chat-agent.service.d.ts.map +1 -1
  2. package/lib/browser/chat/chat-agent.service.js +4 -4
  3. package/lib/browser/chat/chat-agent.service.js.map +1 -1
  4. package/lib/browser/chat/chat-model.d.ts +2 -2
  5. package/lib/browser/chat/chat-model.d.ts.map +1 -1
  6. package/lib/browser/chat/chat-model.js +1 -18
  7. package/lib/browser/chat/chat-model.js.map +1 -1
  8. package/lib/browser/chat/chat.view.d.ts.map +1 -1
  9. package/lib/browser/chat/chat.view.js +16 -46
  10. package/lib/browser/chat/chat.view.js.map +1 -1
  11. package/lib/browser/components/{chat-context/context-selector.d.ts → ChatContext/ContextSelector.d.ts} +1 -1
  12. package/lib/browser/components/ChatContext/ContextSelector.d.ts.map +1 -0
  13. package/lib/browser/components/{chat-context/context-selector.js → ChatContext/ContextSelector.js} +1 -1
  14. package/lib/browser/components/ChatContext/ContextSelector.js.map +1 -0
  15. package/lib/browser/components/ChatContext/index.d.ts.map +1 -0
  16. package/lib/browser/components/{chat-context → ChatContext}/index.js +2 -2
  17. package/lib/browser/components/ChatContext/index.js.map +1 -0
  18. package/lib/browser/components/ChatReply.d.ts.map +1 -1
  19. package/lib/browser/components/ChatReply.js +17 -35
  20. package/lib/browser/components/ChatReply.js.map +1 -1
  21. package/lib/browser/components/ChatThinking.js +1 -1
  22. package/lib/browser/components/ChatThinking.js.map +1 -1
  23. package/lib/browser/components/WelcomeMsg.js +1 -1
  24. package/lib/browser/components/WelcomeMsg.js.map +1 -1
  25. package/lib/browser/components/components.module.less +0 -25
  26. package/lib/browser/context/llm-context.service.d.ts +2 -10
  27. package/lib/browser/context/llm-context.service.d.ts.map +1 -1
  28. package/lib/browser/context/llm-context.service.js +2 -71
  29. package/lib/browser/context/llm-context.service.js.map +1 -1
  30. package/lib/browser/contrib/inline-completions/prompt/matcher.js +2 -2
  31. package/lib/browser/contrib/inline-completions/prompt/similarSnippets.d.ts +1 -1
  32. package/lib/browser/contrib/inline-completions/prompt/similarSnippets.js +2 -2
  33. package/lib/browser/contrib/intelligent-completions/view/default.d.ts.map +1 -1
  34. package/lib/browser/contrib/intelligent-completions/view/default.js.map +1 -1
  35. package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -1
  36. package/lib/browser/mcp/config/components/mcp-config.view.js +18 -28
  37. package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
  38. package/lib/browser/mcp/config/components/mcp-server-form.d.ts.map +1 -1
  39. package/lib/browser/mcp/config/components/mcp-server-form.js +25 -33
  40. package/lib/browser/mcp/config/components/mcp-server-form.js.map +1 -1
  41. package/lib/browser/mcp/mcp-server.feature.registry.js +1 -1
  42. package/lib/browser/mcp/mcp-server.feature.registry.js.map +1 -1
  43. package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts.map +1 -1
  44. package/lib/browser/mcp/tools/components/ExpandableFileList.js +1 -3
  45. package/lib/browser/mcp/tools/components/ExpandableFileList.js.map +1 -1
  46. package/lib/browser/mcp/tools/components/Terminal.d.ts.map +1 -1
  47. package/lib/browser/mcp/tools/components/Terminal.js +5 -6
  48. package/lib/browser/mcp/tools/components/Terminal.js.map +1 -1
  49. package/lib/browser/mcp/tools/components/index.module.less +5 -8
  50. package/lib/browser/mcp/tools/createNewFileWithText.d.ts.map +1 -1
  51. package/lib/browser/mcp/tools/createNewFileWithText.js +0 -1
  52. package/lib/browser/mcp/tools/createNewFileWithText.js.map +1 -1
  53. package/lib/browser/mcp/tools/editFile.d.ts.map +1 -1
  54. package/lib/browser/mcp/tools/editFile.js +0 -1
  55. package/lib/browser/mcp/tools/editFile.js.map +1 -1
  56. package/lib/browser/mcp/tools/fileSearch.d.ts.map +1 -1
  57. package/lib/browser/mcp/tools/fileSearch.js +0 -1
  58. package/lib/browser/mcp/tools/fileSearch.js.map +1 -1
  59. package/lib/browser/mcp/tools/getDiagnosticsByPath.d.ts.map +1 -1
  60. package/lib/browser/mcp/tools/getDiagnosticsByPath.js +1 -2
  61. package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
  62. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.d.ts.map +1 -1
  63. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js +0 -2
  64. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js.map +1 -1
  65. package/lib/browser/mcp/tools/grepSearch.d.ts.map +1 -1
  66. package/lib/browser/mcp/tools/grepSearch.js +0 -1
  67. package/lib/browser/mcp/tools/grepSearch.js.map +1 -1
  68. package/lib/browser/mcp/tools/listDir.d.ts.map +1 -1
  69. package/lib/browser/mcp/tools/listDir.js +0 -1
  70. package/lib/browser/mcp/tools/listDir.js.map +1 -1
  71. package/lib/browser/mcp/tools/readFile.d.ts.map +1 -1
  72. package/lib/browser/mcp/tools/readFile.js +0 -1
  73. package/lib/browser/mcp/tools/readFile.js.map +1 -1
  74. package/lib/browser/mcp/tools/runTerminalCmd.d.ts.map +1 -1
  75. package/lib/browser/mcp/tools/runTerminalCmd.js +0 -1
  76. package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
  77. package/lib/browser/types.d.ts +0 -1
  78. package/lib/browser/types.d.ts.map +1 -1
  79. package/lib/browser/widget/inline-diff/inline-diff-manager.d.ts.map +1 -1
  80. package/lib/browser/widget/inline-diff/inline-diff-manager.js.map +1 -1
  81. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
  82. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +5 -10
  83. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
  84. package/lib/common/llm-context.d.ts +1 -15
  85. package/lib/common/llm-context.d.ts.map +1 -1
  86. package/lib/common/llm-context.js.map +1 -1
  87. package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
  88. package/lib/common/prompts/context-prompt-provider.js +21 -26
  89. package/lib/common/prompts/context-prompt-provider.js.map +1 -1
  90. package/lib/node/base-language-model.d.ts.map +1 -1
  91. package/lib/node/base-language-model.js +0 -6
  92. package/lib/node/base-language-model.js.map +1 -1
  93. package/package.json +23 -24
  94. package/src/browser/chat/chat-agent.service.ts +4 -4
  95. package/src/browser/chat/chat-model.ts +2 -19
  96. package/src/browser/chat/chat.view.tsx +19 -47
  97. package/src/browser/components/{chat-context → ChatContext}/index.tsx +1 -1
  98. package/src/browser/components/ChatReply.tsx +18 -61
  99. package/src/browser/components/ChatThinking.tsx +1 -1
  100. package/src/browser/components/WelcomeMsg.tsx +1 -1
  101. package/src/browser/components/components.module.less +0 -25
  102. package/src/browser/context/llm-context.service.ts +3 -83
  103. package/src/browser/contrib/inline-completions/prompt/matcher.ts +2 -2
  104. package/src/browser/contrib/inline-completions/prompt/similarSnippets.ts +2 -2
  105. package/src/browser/contrib/intelligent-completions/view/default.ts +1 -0
  106. package/src/browser/mcp/config/components/mcp-config.view.tsx +12 -23
  107. package/src/browser/mcp/config/components/mcp-server-form.tsx +54 -68
  108. package/src/browser/mcp/mcp-server.feature.registry.ts +1 -1
  109. package/src/browser/mcp/tools/components/ExpandableFileList.tsx +1 -4
  110. package/src/browser/mcp/tools/components/Terminal.tsx +6 -4
  111. package/src/browser/mcp/tools/components/index.module.less +5 -8
  112. package/src/browser/mcp/tools/createNewFileWithText.ts +0 -1
  113. package/src/browser/mcp/tools/editFile.ts +0 -1
  114. package/src/browser/mcp/tools/fileSearch.ts +0 -1
  115. package/src/browser/mcp/tools/getDiagnosticsByPath.ts +1 -2
  116. package/src/browser/mcp/tools/getOpenEditorFileDiagnostics.ts +0 -2
  117. package/src/browser/mcp/tools/grepSearch.ts +0 -1
  118. package/src/browser/mcp/tools/listDir.ts +0 -1
  119. package/src/browser/mcp/tools/readFile.ts +0 -1
  120. package/src/browser/mcp/tools/runTerminalCmd.ts +0 -1
  121. package/src/browser/types.ts +0 -1
  122. package/src/browser/widget/inline-diff/inline-diff-manager.tsx +1 -0
  123. package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +5 -9
  124. package/src/common/llm-context.ts +1 -16
  125. package/src/common/prompts/context-prompt-provider.ts +24 -31
  126. package/src/node/base-language-model.ts +0 -5
  127. package/lib/browser/components/ChatMentionInput.d.ts +0 -25
  128. package/lib/browser/components/ChatMentionInput.d.ts.map +0 -1
  129. package/lib/browser/components/ChatMentionInput.js +0 -221
  130. package/lib/browser/components/ChatMentionInput.js.map +0 -1
  131. package/lib/browser/components/chat-context/context-selector.d.ts.map +0 -1
  132. package/lib/browser/components/chat-context/context-selector.js.map +0 -1
  133. package/lib/browser/components/chat-context/index.d.ts.map +0 -1
  134. package/lib/browser/components/chat-context/index.js.map +0 -1
  135. package/lib/browser/components/mention-input/mention-input.d.ts +0 -5
  136. package/lib/browser/components/mention-input/mention-input.d.ts.map +0 -1
  137. package/lib/browser/components/mention-input/mention-input.js +0 -733
  138. package/lib/browser/components/mention-input/mention-input.js.map +0 -1
  139. package/lib/browser/components/mention-input/mention-input.module.less +0 -309
  140. package/lib/browser/components/mention-input/mention-item.d.ts +0 -10
  141. package/lib/browser/components/mention-input/mention-item.d.ts.map +0 -1
  142. package/lib/browser/components/mention-input/mention-item.js +0 -16
  143. package/lib/browser/components/mention-input/mention-item.js.map +0 -1
  144. package/lib/browser/components/mention-input/mention-panel.d.ts +0 -15
  145. package/lib/browser/components/mention-input/mention-panel.d.ts.map +0 -1
  146. package/lib/browser/components/mention-input/mention-panel.js +0 -49
  147. package/lib/browser/components/mention-input/mention-panel.js.map +0 -1
  148. package/lib/browser/components/mention-input/types.d.ts +0 -73
  149. package/lib/browser/components/mention-input/types.d.ts.map +0 -1
  150. package/lib/browser/components/mention-input/types.js +0 -16
  151. package/lib/browser/components/mention-input/types.js.map +0 -1
  152. package/lib/browser/mcp/tools/components/computeAnsiLogString.d.ts +0 -4
  153. package/lib/browser/mcp/tools/components/computeAnsiLogString.d.ts.map +0 -1
  154. package/lib/browser/mcp/tools/components/computeAnsiLogString.js +0 -22
  155. package/lib/browser/mcp/tools/components/computeAnsiLogString.js.map +0 -1
  156. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.d.ts +0 -18
  157. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.d.ts.map +0 -1
  158. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.js +0 -69
  159. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.js.map +0 -1
  160. package/src/browser/components/ChatMentionInput.tsx +0 -267
  161. package/src/browser/components/mention-input/mention-input.module.less +0 -309
  162. package/src/browser/components/mention-input/mention-input.tsx +0 -905
  163. package/src/browser/components/mention-input/mention-item.tsx +0 -24
  164. package/src/browser/components/mention-input/mention-panel.tsx +0 -89
  165. package/src/browser/components/mention-input/types.ts +0 -78
  166. package/src/browser/mcp/tools/components/computeAnsiLogString.ts +0 -24
  167. package/src/browser/mcp/tools/components/filterEraseMultipleLine.ts +0 -71
  168. /package/lib/browser/components/{chat-context → ChatContext}/index.d.ts +0 -0
  169. /package/lib/browser/components/{chat-context → ChatContext}/style.module.less +0 -0
  170. /package/src/browser/components/{chat-context/context-selector.tsx → ChatContext/ContextSelector.tsx} +0 -0
  171. /package/src/browser/components/{chat-context → ChatContext}/style.module.less +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-ai-native",
3
- "version": "3.8.3-next-1741745665.0",
3
+ "version": "3.8.3-next-1741752385.0",
4
4
  "files": [
5
5
  "lib",
6
6
  "src"
@@ -24,30 +24,29 @@
24
24
  "@ai-sdk/openai": "^1.1.9",
25
25
  "@ai-sdk/openai-compatible": "^0.1.11",
26
26
  "@modelcontextprotocol/sdk": "^1.3.1",
27
- "@opensumi/ide-addons": "3.8.3-next-1741745665.0",
28
- "@opensumi/ide-components": "3.8.3-next-1741745665.0",
29
- "@opensumi/ide-connection": "3.8.3-next-1741745665.0",
30
- "@opensumi/ide-core-common": "3.8.3-next-1741745665.0",
31
- "@opensumi/ide-core-node": "3.8.3-next-1741745665.0",
32
- "@opensumi/ide-debug": "3.8.3-next-1741745665.0",
33
- "@opensumi/ide-design": "3.8.3-next-1741745665.0",
34
- "@opensumi/ide-editor": "3.8.3-next-1741745665.0",
35
- "@opensumi/ide-file-search": "3.8.3-next-1741745665.0",
36
- "@opensumi/ide-file-service": "3.8.3-next-1741745665.0",
37
- "@opensumi/ide-main-layout": "3.8.3-next-1741745665.0",
38
- "@opensumi/ide-markers": "3.8.3-next-1741745665.0",
39
- "@opensumi/ide-monaco": "3.8.3-next-1741745665.0",
40
- "@opensumi/ide-overlay": "3.8.3-next-1741745665.0",
41
- "@opensumi/ide-preferences": "3.8.3-next-1741745665.0",
42
- "@opensumi/ide-search": "3.8.3-next-1741745665.0",
43
- "@opensumi/ide-terminal-next": "3.8.3-next-1741745665.0",
44
- "@opensumi/ide-theme": "3.8.3-next-1741745665.0",
45
- "@opensumi/ide-utils": "3.8.3-next-1741745665.0",
46
- "@opensumi/ide-workspace": "3.8.3-next-1741745665.0",
27
+ "@opensumi/ide-addons": "3.8.3-next-1741752385.0",
28
+ "@opensumi/ide-components": "3.8.3-next-1741752385.0",
29
+ "@opensumi/ide-connection": "3.8.3-next-1741752385.0",
30
+ "@opensumi/ide-core-common": "3.8.3-next-1741752385.0",
31
+ "@opensumi/ide-core-node": "3.8.3-next-1741752385.0",
32
+ "@opensumi/ide-debug": "3.8.3-next-1741752385.0",
33
+ "@opensumi/ide-design": "3.8.3-next-1741752385.0",
34
+ "@opensumi/ide-editor": "3.8.3-next-1741752385.0",
35
+ "@opensumi/ide-file-search": "3.8.3-next-1741752385.0",
36
+ "@opensumi/ide-file-service": "3.8.3-next-1741752385.0",
37
+ "@opensumi/ide-main-layout": "3.8.3-next-1741752385.0",
38
+ "@opensumi/ide-markers": "3.8.3-next-1741752385.0",
39
+ "@opensumi/ide-monaco": "3.8.3-next-1741752385.0",
40
+ "@opensumi/ide-overlay": "3.8.3-next-1741752385.0",
41
+ "@opensumi/ide-preferences": "3.8.3-next-1741752385.0",
42
+ "@opensumi/ide-search": "3.8.3-next-1741752385.0",
43
+ "@opensumi/ide-terminal-next": "3.8.3-next-1741752385.0",
44
+ "@opensumi/ide-theme": "3.8.3-next-1741752385.0",
45
+ "@opensumi/ide-utils": "3.8.3-next-1741752385.0",
46
+ "@opensumi/ide-workspace": "3.8.3-next-1741752385.0",
47
47
  "@xterm/xterm": "5.5.0",
48
48
  "ai": "^4.1.45",
49
49
  "ansi-regex": "^2.0.0",
50
- "ansi_up": "^5.1.0",
51
50
  "diff": "^7.0.0",
52
51
  "dom-align": "^1.7.0",
53
52
  "eventsource": "^3.0.5",
@@ -60,7 +59,7 @@
60
59
  "zod-to-json-schema": "^3.24.1"
61
60
  },
62
61
  "devDependencies": {
63
- "@opensumi/ide-core-browser": "3.8.3-next-1741745665.0"
62
+ "@opensumi/ide-core-browser": "3.8.3-next-1741752385.0"
64
63
  },
65
- "gitHead": "6b81c694c77428c9536e22cbac047e61ebf759ae"
64
+ "gitHead": "e1329714e555d8149d12fcedbedff58013fd5e55"
66
65
  }
@@ -152,9 +152,9 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
152
152
  if (!this.initialUserMessageMap.has(request.sessionId)) {
153
153
  this.initialUserMessageMap.set(request.sessionId, request.message);
154
154
  const rawMessage = request.message;
155
- request.message = await this.provideContextMessage(rawMessage, request.sessionId);
155
+ request.message = this.provideContextMessage(rawMessage, request.sessionId);
156
156
  } else if (this.shouldUpdateContext || request.regenerate || history.length === 0) {
157
- request.message = await this.provideContextMessage(request.message, request.sessionId);
157
+ request.message = this.provideContextMessage(request.message, request.sessionId);
158
158
  this.shouldUpdateContext = false;
159
159
  }
160
160
 
@@ -162,8 +162,8 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
162
162
  return result;
163
163
  }
164
164
 
165
- private async provideContextMessage(message: string, sessionId: string) {
166
- const context = await this.contextService.serialize();
165
+ private provideContextMessage(message: string, sessionId: string) {
166
+ const context = this.contextService.serialize();
167
167
  const fullMessage = this.promptProvider.provideContextPrompt(context, message);
168
168
  this.aiReporter.send({
169
169
  msgType: AIServiceType.Chat,
@@ -6,7 +6,6 @@ import {
6
6
  IChatComponent,
7
7
  IChatMarkdownContent,
8
8
  IChatProgress,
9
- IChatReasoning,
10
9
  IChatToolContent,
11
10
  IChatTreeData,
12
11
  uuid,
@@ -34,8 +33,7 @@ export type IChatProgressResponseContent =
34
33
  | IChatAsyncContent
35
34
  | IChatTreeData
36
35
  | IChatComponent
37
- | IChatToolContent
38
- | IChatReasoning;
36
+ | IChatToolContent;
39
37
 
40
38
  export class ChatResponseModel extends Disposable {
41
39
  #responseParts: IChatProgressResponseContent[] = [];
@@ -133,18 +131,6 @@ export class ChatResponseModel extends Disposable {
133
131
  };
134
132
  }
135
133
 
136
- this.#updateResponseText();
137
- } else if (progress.kind === 'reasoning') {
138
- const lastResponsePart = this.#responseParts[responsePartLength];
139
- if (!lastResponsePart || lastResponsePart.kind !== 'reasoning') {
140
- // 去掉开头的 <think> 标签
141
- this.#responseParts.push({ content: progress.content.replace(/^<think>/, ''), kind: 'reasoning' });
142
- } else {
143
- this.#responseParts[responsePartLength] = {
144
- content: lastResponsePart.content + progress.content,
145
- kind: 'reasoning',
146
- };
147
- }
148
134
  this.#updateResponseText();
149
135
  } else if (progress.kind === 'asyncContent') {
150
136
  // Add a new resolving part
@@ -195,9 +181,6 @@ export class ChatResponseModel extends Disposable {
195
181
  if (part.kind === 'toolCall') {
196
182
  return part.content.function.name;
197
183
  }
198
- if (part.kind === 'reasoning') {
199
- return '';
200
- }
201
184
  return part.content.value;
202
185
  })
203
186
  .join('\n\n');
@@ -404,7 +387,7 @@ export class ChatModel extends Disposable implements IChatModel {
404
387
 
405
388
  const { kind } = progress;
406
389
 
407
- const basicKind = ['content', 'markdownContent', 'asyncContent', 'treeData', 'component', 'toolCall', 'reasoning'];
390
+ const basicKind = ['content', 'markdownContent', 'asyncContent', 'treeData', 'component', 'toolCall'];
408
391
 
409
392
  if (basicKind.includes(kind)) {
410
393
  request.response.updateContent(progress, quiet);
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MessageList } from 'react-chat-elements';
3
3
 
4
- import { AINativeConfigService, AppConfig, getIcon, useInjectable, useUpdateOnEvent } from '@opensumi/ide-core-browser';
4
+ import { AppConfig, getIcon, useInjectable, useUpdateOnEvent } from '@opensumi/ide-core-browser';
5
5
  import { Popover, PopoverPosition } from '@opensumi/ide-core-browser/lib/components';
6
6
  import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
7
7
  import {
@@ -31,14 +31,13 @@ import { IMessageService } from '@opensumi/ide-overlay';
31
31
 
32
32
  import 'react-chat-elements/dist/main.css';
33
33
  import { AI_CHAT_VIEW_ID, IChatAgentService, IChatInternalService, IChatMessageStructure } from '../../common';
34
- import { LLMContextService, LLMContextServiceToken } from '../../common/llm-context';
35
34
  import { CodeBlockData } from '../../common/types';
36
35
  import { FileChange, FileListDisplay } from '../components/ChangeList';
36
+ import { ChatContext } from '../components/ChatContext';
37
37
  import { CodeBlockWrapperInput } from '../components/ChatEditor';
38
38
  import ChatHistory, { IChatHistoryItem } from '../components/ChatHistory';
39
39
  import { ChatInput } from '../components/ChatInput';
40
40
  import { ChatMarkdown } from '../components/ChatMarkdown';
41
- import { ChatMentionInput } from '../components/ChatMentionInput';
42
41
  import { ChatNotify, ChatReply } from '../components/ChatReply';
43
42
  import { SlashCustomRender } from '../components/SlashCustomRender';
44
43
  import { MessageData, createMessageByAI, createMessageByUser } from '../components/utils';
@@ -106,8 +105,6 @@ export const AIChatView = () => {
106
105
  const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
107
106
  const chatRenderRegistry = useInjectable<ChatRenderRegistry>(ChatRenderRegistryToken);
108
107
  const mcpServerRegistry = useInjectable<IMCPServerRegistry>(TokenMCPServerRegistry);
109
- const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
110
- const llmContextService = useInjectable<LLMContextService>(LLMContextServiceToken);
111
108
 
112
109
  const layoutService = useInjectable<IMainLayoutService>(IMainLayoutService);
113
110
  const msgHistoryManager = aiChatService.sessionModel.history;
@@ -187,9 +184,6 @@ export const AIChatView = () => {
187
184
  if (chatRenderRegistry.chatInputRender) {
188
185
  return chatRenderRegistry.chatInputRender;
189
186
  }
190
- if (aiNativeConfigService.capabilities.supportsMCP) {
191
- return ChatMentionInput;
192
- }
193
187
  return ChatInput;
194
188
  }, [chatRenderRegistry.chatInputRender]);
195
189
 
@@ -268,7 +262,7 @@ export const AIChatView = () => {
268
262
  if (loading) {
269
263
  return;
270
264
  }
271
- await handleSend(message.message, message.agentId, message.command);
265
+ await handleSend(message);
272
266
  } else {
273
267
  if (message.agentId) {
274
268
  setAgentId(message.agentId);
@@ -644,44 +638,11 @@ export const AIChatView = () => {
644
638
  );
645
639
 
646
640
  const handleSend = React.useCallback(
647
- async (message: string, agentId?: string, command?: string) => {
648
- const reportExtra = {
649
- actionSource: ActionSourceEnum.Chat,
650
- actionType: ActionTypeEnum.Send,
651
- };
652
- agentId = agentId ? agentId : ChatProxyService.AGENT_ID;
653
- // 提取并替换 {{@file:xxx}} 中的文件内容
654
- let processedContent = message;
655
- const filePattern = /\{\{@file:(.*?)\}\}/g;
656
- const fileMatches = message.match(filePattern);
657
- let isCleanContext = false;
658
- if (fileMatches) {
659
- for (const match of fileMatches) {
660
- const filePath = match.replace(/\{\{@file:(.*?)\}\}/, '$1');
661
- if (filePath && !isCleanContext) {
662
- isCleanContext = true;
663
- llmContextService.cleanFileContext();
664
- }
665
- const fileUri = new URI(filePath);
666
- llmContextService.addFileToContext(fileUri, undefined, true);
667
- // 获取文件内容
668
- // 替换占位符,后续支持自定义渲染时可替换为自定义渲染标签
669
- processedContent = processedContent.replace(match, `\`File:${fileUri.displayName}\``);
670
- }
671
- }
641
+ async (value: IChatMessageStructure) => {
642
+ const { message, command, reportExtra } = value;
672
643
 
673
- const folderPattern = /\{\{@folder:(.*?)\}\}/g;
674
- const folderMatches = processedContent.match(folderPattern);
675
- if (folderMatches) {
676
- for (const match of folderMatches) {
677
- const folderPath = match.replace(/\{\{@folder:(.*?)\}\}/, '$1');
678
- const folderUri = new URI(folderPath);
679
- llmContextService.addFolderToContext(folderUri);
680
- // 替换占位符,后续支持自定义渲染时可替换为自定义渲染标签
681
- processedContent = processedContent.replace(match, `\`Folder:${folderUri.displayName}\``);
682
- }
683
- }
684
- return handleAgentReply({ message: processedContent, agentId, command, reportExtra });
644
+ const agentId = value.agentId ? value.agentId : ChatProxyService.AGENT_ID;
645
+ return handleAgentReply({ message, agentId, command, reportExtra });
685
646
  },
686
647
  [handleAgentReply],
687
648
  );
@@ -798,6 +759,7 @@ export const AIChatView = () => {
798
759
  </div>
799
760
  ) : null}
800
761
  <div className={styles.chat_input_wrap}>
762
+ <ChatContext />
801
763
  <div className={styles.header_operate}>
802
764
  <div className={styles.header_operate_left}>
803
765
  {shortcutCommands.map((command) => (
@@ -828,7 +790,17 @@ export const AIChatView = () => {
828
790
  />
829
791
  )}
830
792
  <ChatInputWrapperRender
831
- onSend={handleSend}
793
+ onSend={(value, agentId, command) =>
794
+ handleSend({
795
+ message: value,
796
+ agentId,
797
+ command,
798
+ reportExtra: {
799
+ actionSource: ActionSourceEnum.Chat,
800
+ actionType: ActionTypeEnum.Send,
801
+ },
802
+ })
803
+ }
832
804
  disabled={loading}
833
805
  enableOptions={true}
834
806
  theme={theme}
@@ -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 './context-selector';
18
+ import { ContextSelector } from './ContextSelector';
19
19
  import styles from './style.module.less';
20
20
 
21
21
  const getCollapsedHeight = () => ({ height: 0, opacity: 0 });
@@ -1,4 +1,3 @@
1
- import cls from 'classnames';
2
1
  import React, {
3
2
  Fragment,
4
3
  ReactNode,
@@ -41,7 +40,6 @@ import {
41
40
  IChatResponseProgressFileTreeData,
42
41
  IChatToolContent,
43
42
  URI,
44
- localize,
45
43
  } from '@opensumi/ide-core-common';
46
44
  import { IIconService } from '@opensumi/ide-theme';
47
45
  import { IMarkdownString, MarkdownString } from '@opensumi/monaco-editor-core/esm/vs/base/common/htmlContent';
@@ -226,28 +224,6 @@ export const ChatReply = (props: IChatReplyProps) => {
226
224
  const chatApiService = useInjectable<ChatService>(ChatServiceToken);
227
225
  const chatAgentService = useInjectable<IChatAgentService>(IChatAgentService);
228
226
  const chatRenderRegistry = useInjectable<ChatRenderRegistry>(ChatRenderRegistryToken);
229
- const [collapseThinkingIndexSet, setCollapseThinkingIndexSet] = useState<Set<number>>(
230
- !request.response.isComplete
231
- ? new Set()
232
- : new Set(
233
- request.response.responseContents
234
- .map((item, index) => (item.kind === 'reasoning' ? index : -1))
235
- .filter((item) => item !== -1),
236
- ),
237
- );
238
-
239
- useEffect(() => {
240
- if (request.response.isComplete) {
241
- setCollapseThinkingIndexSet(
242
- new Set(
243
- request.response.responseContents
244
- .map((item, index) => (item.kind === 'reasoning' ? index : -1))
245
- .filter((item) => item !== -1),
246
- ),
247
- );
248
- }
249
- }, [request.response.isComplete]);
250
-
251
227
  useEffect(() => {
252
228
  const disposableCollection = new DisposableCollection();
253
229
 
@@ -287,6 +263,23 @@ export const ChatReply = (props: IChatReplyProps) => {
287
263
  onRegenerate?.();
288
264
  }, [onRegenerate]);
289
265
 
266
+ const onStop = () => {
267
+ if (onDone) {
268
+ onDone();
269
+ }
270
+ aiReporter.end(relationId, {
271
+ assistantMessage: request.response.responseText,
272
+ replytime: Date.now() - startTime,
273
+ success: false,
274
+ isStop: true,
275
+ command,
276
+ agentId,
277
+ messageId: msgId,
278
+ sessionId: aiChatService.sessionModel.sessionId,
279
+ });
280
+ aiChatService.cancelRequest();
281
+ };
282
+
290
283
  const renderMarkdown = useCallback(
291
284
  (markdown: IMarkdownString) => {
292
285
  if (chatRenderRegistry.chatAIRoleRender) {
@@ -320,48 +313,12 @@ export const ChatReply = (props: IChatReplyProps) => {
320
313
  node = <ComponentRender component={item.component} value={item.value} messageId={msgId} />;
321
314
  } else if (item.kind === 'toolCall') {
322
315
  node = <ToolCallRender toolCall={item.content} messageId={msgId} />;
323
- } else if (item.kind === 'reasoning') {
324
- // 思考中必然为最后一条
325
- const isThinking = index === request.response.responseContents.length - 1 && !request.response.isComplete;
326
- node = (
327
- <div className={cls(styles.reasoning, { [styles.thinking]: isThinking })}>
328
- <Button
329
- size='small'
330
- type='secondary'
331
- className={styles.thinking}
332
- onClick={() => {
333
- if (isThinking) {
334
- return;
335
- }
336
- if (collapseThinkingIndexSet.has(index)) {
337
- collapseThinkingIndexSet.delete(index);
338
- } else {
339
- collapseThinkingIndexSet.add(index);
340
- }
341
- setCollapseThinkingIndexSet(new Set(collapseThinkingIndexSet));
342
- }}
343
- >
344
- <Icon iconClass='codicon codicon-sparkle' />
345
- {localize('aiNative.chat.thinking')}
346
- {isThinking ? (
347
- <Loading />
348
- ) : collapseThinkingIndexSet.has(index) ? (
349
- <Icon iconClass='codicon codicon-chevron-right' />
350
- ) : (
351
- <Icon iconClass='codicon codicon-chevron-down' />
352
- )}
353
- </Button>
354
- {!collapseThinkingIndexSet.has(index) ? (
355
- <div className={styles.reasoning_content}>{renderMarkdown(new MarkdownString(item.content))}</div>
356
- ) : null}
357
- </div>
358
- );
359
316
  } else {
360
317
  node = renderMarkdown(item.content);
361
318
  }
362
319
  return <Fragment key={`${item.kind}-${index}`}>{node}</Fragment>;
363
320
  }),
364
- [request.response.responseContents, collapseThinkingIndexSet],
321
+ [request.response.responseContents],
365
322
  );
366
323
 
367
324
  const followupNode = React.useMemo(() => {
@@ -33,7 +33,7 @@ export const ChatThinking = (props: ITinkingProps) => {
33
33
  );
34
34
 
35
35
  const renderContent = useCallback(() => {
36
- if (!children) {
36
+ if (!children || !message?.trim()) {
37
37
  if (CustomThinkingRender) {
38
38
  return <CustomThinkingRender thinkingText={thinkingText} />;
39
39
  }
@@ -79,7 +79,7 @@ export const WelcomeMessage = () => {
79
79
  return (
80
80
  <div className={styles.chat_welcome_head}>
81
81
  <div className={styles.chat_container_des}>
82
- {isMarkdownString(welcomeMessage) ? <ChatMarkdown key='welcome' markdown={welcomeMessage} /> : welcomeMessage}
82
+ {isMarkdownString(welcomeMessage) ? <ChatMarkdown markdown={welcomeMessage} /> : welcomeMessage}
83
83
  </div>
84
84
  <div className={styles.chat_container_content}>
85
85
  {allSampleQuestions.map((data: any, index) => {
@@ -519,7 +519,6 @@
519
519
  display: flex;
520
520
  font-size: 11px;
521
521
  align-items: center;
522
- min-width: 150px;
523
522
  }
524
523
 
525
524
  .mcp_desc {
@@ -542,27 +541,3 @@
542
541
  }
543
542
  }
544
543
  }
545
-
546
- .reasoning {
547
- .thinking {
548
- display: flex;
549
- align-items: center;
550
- gap: 4px;
551
- margin-bottom: 4px;
552
- transition: color 0.2s ease-in-out;
553
- :global {
554
- .codicon {
555
- color: inherit;
556
- }
557
- .codicon-sparkle {
558
- margin-right: -1px;
559
- font-size: 14px;
560
- }
561
- }
562
- }
563
- .reasoning_content {
564
- padding-left: 12px;
565
- border-left: 2px solid var(--descriptionForeground);
566
- color: var(--descriptionForeground);
567
- }
568
- }
@@ -10,7 +10,6 @@ import {
10
10
  IEditorDocumentModelService,
11
11
  } from '@opensumi/ide-editor/lib/browser/doc-model/types';
12
12
  import { EditorSelectionChangeEvent } from '@opensumi/ide-editor/lib/browser/types';
13
- import { FileType, IFileServiceClient } from '@opensumi/ide-file-service';
14
13
  import { IMarkerService } from '@opensumi/ide-markers/lib/common/types';
15
14
  import { Range } from '@opensumi/ide-monaco';
16
15
 
@@ -27,18 +26,13 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
27
26
  @Autowired(IMarkerService)
28
27
  protected readonly markerService: IMarkerService;
29
28
 
30
- @Autowired(IFileServiceClient)
31
- protected readonly fileService: IFileServiceClient;
32
-
33
29
  private isAutoCollecting = false;
34
30
 
35
31
  private contextVersion = 0;
36
32
 
37
33
  private readonly maxAttachFilesLimit = 10;
38
- private readonly maxAttachFoldersLimit = 10;
39
34
  private readonly maxViewFilesLimit = 20;
40
- private attachedFiles: FileContext[] = [];
41
- private attachedFolders: FileContext[] = [];
35
+ private readonly attachedFiles: FileContext[] = [];
42
36
  private readonly recentlyViewFiles: FileContext[] = [];
43
37
  private readonly onDidContextFilesChangeEmitter = new Emitter<{
44
38
  viewed: FileContext[];
@@ -59,18 +53,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
59
53
  }
60
54
  }
61
55
 
62
- private addFolderToList(folder: FileContext, list: FileContext[], maxLimit: number) {
63
- const existingIndex = list.findIndex((f) => f.uri.toString() === folder.uri.toString());
64
- if (existingIndex > -1) {
65
- list.splice(existingIndex, 1);
66
- }
67
-
68
- list.push(folder);
69
- if (list.length > maxLimit) {
70
- list.shift();
71
- }
72
- }
73
-
74
56
  addFileToContext(uri: URI, selection?: [number, number], isManual = false): void {
75
57
  if (!uri) {
76
58
  return;
@@ -88,24 +70,12 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
88
70
  this.notifyContextChange();
89
71
  }
90
72
 
91
- addFolderToContext(uri: URI): void {
92
- if (!uri) {
93
- return;
94
- }
95
-
96
- const file = { uri };
97
-
98
- this.addFolderToList(file, this.attachedFolders, this.maxAttachFoldersLimit);
99
- this.notifyContextChange();
100
- }
101
-
102
73
  private notifyContextChange(): void {
103
74
  this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles());
104
75
  }
105
76
 
106
77
  cleanFileContext() {
107
- this.attachedFiles = [];
108
- this.attachedFolders = [];
78
+ this.attachedFiles.length = 0;
109
79
  this.notifyContextChange();
110
80
  }
111
81
 
@@ -113,7 +83,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
113
83
  return {
114
84
  viewed: this.recentlyViewFiles,
115
85
  attached: this.attachedFiles,
116
- attachedFolders: this.attachedFolders,
117
86
  version: this.contextVersion++,
118
87
  };
119
88
  }
@@ -191,65 +160,16 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
191
160
  this.dispose();
192
161
  }
193
162
 
194
- async serialize(): Promise<SerializedContext> {
163
+ serialize(): SerializedContext {
195
164
  const files = this.getAllContextFiles();
196
165
  const workspaceRoot = URI.file(this.appConfig.workspaceDir);
197
166
 
198
167
  return {
199
168
  recentlyViewFiles: this.serializeRecentlyViewFiles(files.viewed, workspaceRoot),
200
169
  attachedFiles: this.serializeAttachedFiles(files.attached, workspaceRoot),
201
- attachedFolders: await this.serializeAttachedFolders(files.attachedFolders, workspaceRoot),
202
170
  };
203
171
  }
204
172
 
205
- private async serializeAttachedFolders(folders: FileContext[], workspaceRoot: URI): Promise<string[]> {
206
- // 去重
207
- const folderPath = Array.from(new Set(folders.map((folder) => folder.uri.toString())));
208
- return Promise.all(
209
- folderPath.map(async (folder) => {
210
- const folderUri = new URI(folder);
211
- const root = workspaceRoot.relative(folderUri)?.toString() || '/';
212
- return `# Partial Folder Structure\n\`\`\`\n${root}\n${(
213
- await this.getPartiaFolderStructure(folderUri.codeUri.fsPath)
214
- )
215
- .map((line) => `- ${line}`)
216
- .join('\n')}\n\`\`\`\n`;
217
- }),
218
- );
219
- }
220
-
221
- private async getPartiaFolderStructure(folder: string, level = 2): Promise<string[]> {
222
- const result: string[] = [];
223
- const stat = await this.fileService.getFileStat(folder);
224
-
225
- for (const child of stat?.children || []) {
226
- const relativePath = new URI(folder).relative(new URI(child.uri))!.toString();
227
-
228
- if (child.isSymbolicLink) {
229
- // 处理软链接
230
- const target = await this.fileService.getFileStat(child.realUri || child.uri);
231
- if (target) {
232
- result.push(`${relativePath} -> ${target} (symbolic link)`);
233
- } else {
234
- result.push(`${relativePath} (broken symbolic link)`);
235
- }
236
- continue;
237
- }
238
-
239
- if (child.type === FileType.Directory) {
240
- result.push(`${relativePath}/`);
241
- if (level > 1) {
242
- const subDirStructure = await this.getPartiaFolderStructure(child.uri, level - 1);
243
- result.push(...subDirStructure.map((subEntry) => `${relativePath}/${subEntry}`));
244
- }
245
- } else if (child.type === FileType.File) {
246
- result.push(relativePath);
247
- }
248
- }
249
-
250
- return result;
251
- }
252
-
253
173
  private serializeRecentlyViewFiles(files: FileContext[], workspaceRoot: URI): string[] {
254
174
  return files
255
175
  .map((file) => workspaceRoot.relative(file.uri)?.toString() || file.uri.parent.toString())
@@ -244,8 +244,8 @@ export abstract class WindowedMatcher {
244
244
  tokens.slice(startLine, endLine).forEach((token) => token.forEach((word) => size.add(word)));
245
245
  cache.push(size);
246
246
  }
247
- const target = cache[index];
248
- const score = this.similarityScore(target, this.referenceTokens);
247
+ const traget = cache[index];
248
+ const score = this.similarityScore(traget, this.referenceTokens);
249
249
  snippets.push({
250
250
  score,
251
251
  startLine,
@@ -15,9 +15,9 @@ import {
15
15
  import { MAX_NEIGHBOR_AGGREGATE_LENGTH } from './const';
16
16
  import { FixedWindowSizeJaccardMatcher } from './jaccardMatcher';
17
17
 
18
- export const getOpenedTabFileList = (documents: IEditorDocumentModel[]) => {
18
+ export const getOpenedTabFileList = (docuemnts: IEditorDocumentModel[]) => {
19
19
  // 过滤超大文档
20
- const recentFiles = documents.filter((document) => isDocumentValid(document));
20
+ const recentFiles = docuemnts.filter((document) => isDocumentValid(document));
21
21
  return recentFiles;
22
22
  };
23
23
 
@@ -29,6 +29,7 @@ import {
29
29
 
30
30
  import { CodeEditsResultValue, ICodeEdit, ICodeEditsResult } from '../index';
31
31
 
32
+
32
33
  import { BaseCodeEditsView } from './base';
33
34
 
34
35
  /**