@opensumi/ide-ai-native 3.8.3-next-1741771971.0 → 3.8.3-next-1741772268.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 +18 -55
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/{chat-context/context-selector.d.ts → ChatContext/ContextSelector.d.ts} +1 -1
- package/lib/browser/components/ChatContext/ContextSelector.d.ts.map +1 -0
- package/lib/browser/components/{chat-context/context-selector.js → ChatContext/ContextSelector.js} +1 -1
- package/lib/browser/components/ChatContext/ContextSelector.js.map +1 -0
- package/lib/browser/components/ChatContext/index.d.ts.map +1 -0
- package/lib/browser/components/{chat-context → ChatContext}/index.js +2 -2
- package/lib/browser/components/ChatContext/index.js.map +1 -0
- package/lib/browser/components/ChatEditor.d.ts +2 -11
- package/lib/browser/components/ChatEditor.d.ts.map +1 -1
- package/lib/browser/components/ChatEditor.js +6 -66
- package/lib/browser/components/ChatEditor.js.map +1 -1
- 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 +2 -8
- package/lib/browser/components/ChatThinking.js.map +1 -1
- package/lib/browser/components/change-list.module.less +0 -2
- package/lib/browser/components/components.module.less +2 -34
- package/lib/browser/context/llm-context.service.d.ts +2 -10
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js +2 -71
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/common/llm-context.d.ts +1 -15
- 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 +2 -12
- package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
- package/lib/common/prompts/context-prompt-provider.js +30 -94
- package/lib/common/prompts/context-prompt-provider.js.map +1 -1
- package/lib/node/mcp-server.sse.d.ts.map +1 -1
- package/lib/node/mcp-server.sse.js +2 -2
- package/lib/node/mcp-server.sse.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 +21 -74
- package/src/browser/components/{chat-context → ChatContext}/index.tsx +1 -1
- package/src/browser/components/ChatEditor.tsx +9 -126
- package/src/browser/components/ChatThinking.tsx +4 -10
- package/src/browser/components/change-list.module.less +0 -2
- package/src/browser/components/components.module.less +2 -34
- package/src/browser/context/llm-context.service.ts +3 -81
- package/src/common/llm-context.ts +1 -16
- package/src/common/prompts/context-prompt-provider.ts +36 -126
- package/src/node/mcp-server.sse.ts +2 -1
- package/lib/browser/components/ChatMentionInput.d.ts +0 -25
- package/lib/browser/components/ChatMentionInput.d.ts.map +0 -1
- package/lib/browser/components/ChatMentionInput.js +0 -221
- package/lib/browser/components/ChatMentionInput.js.map +0 -1
- package/lib/browser/components/chat-context/context-selector.d.ts.map +0 -1
- package/lib/browser/components/chat-context/context-selector.js.map +0 -1
- package/lib/browser/components/chat-context/index.d.ts.map +0 -1
- package/lib/browser/components/chat-context/index.js.map +0 -1
- package/lib/browser/components/mention-input/mention-input.d.ts +0 -5
- package/lib/browser/components/mention-input/mention-input.d.ts.map +0 -1
- package/lib/browser/components/mention-input/mention-input.js +0 -763
- package/lib/browser/components/mention-input/mention-input.js.map +0 -1
- package/lib/browser/components/mention-input/mention-input.module.less +0 -329
- package/lib/browser/components/mention-input/mention-item.d.ts +0 -10
- package/lib/browser/components/mention-input/mention-item.d.ts.map +0 -1
- package/lib/browser/components/mention-input/mention-item.js +0 -16
- package/lib/browser/components/mention-input/mention-item.js.map +0 -1
- package/lib/browser/components/mention-input/mention-panel.d.ts +0 -15
- package/lib/browser/components/mention-input/mention-panel.d.ts.map +0 -1
- package/lib/browser/components/mention-input/mention-panel.js +0 -49
- package/lib/browser/components/mention-input/mention-panel.js.map +0 -1
- package/lib/browser/components/mention-input/types.d.ts +0 -78
- package/lib/browser/components/mention-input/types.d.ts.map +0 -1
- package/lib/browser/components/mention-input/types.js +0 -16
- package/lib/browser/components/mention-input/types.js.map +0 -1
- package/src/browser/components/ChatMentionInput.tsx +0 -269
- package/src/browser/components/mention-input/mention-input.module.less +0 -329
- package/src/browser/components/mention-input/mention-input.tsx +0 -952
- package/src/browser/components/mention-input/mention-item.tsx +0 -24
- package/src/browser/components/mention-input/mention-panel.tsx +0 -89
- package/src/browser/components/mention-input/types.ts +0 -84
- /package/lib/browser/components/{chat-context → ChatContext}/index.d.ts +0 -0
- /package/lib/browser/components/{chat-context → ChatContext}/style.module.less +0 -0
- /package/src/browser/components/{chat-context/context-selector.tsx → ChatContext/ContextSelector.tsx} +0 -0
- /package/src/browser/components/{chat-context → ChatContext}/style.module.less +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-prompt-provider.js","sourceRoot":"","sources":["../../../src/common/prompts/context-prompt-provider.ts"],"names":[],"mappings":";;;;AAAA,qCAAqD;AACrD,mEAAgF;
|
|
1
|
+
{"version":3,"file":"context-prompt-provider.js","sourceRoot":"","sources":["../../../src/common/prompts/context-prompt-provider.ts"],"names":[],"mappings":";;;;AAAA,qCAAqD;AACrD,mEAAgF;AAInE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAWlE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAIzC,oBAAoB,CAAC,OAA0B,EAAE,WAAmB;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;QACzD,MAAM,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,oBAAoB,CAAC;QAClD,OAAO;;;;EAIT,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;MAG9E,OAAO,CAAC,aAAa,CAAC,GAAG,CACzB,CAAC,IAAI,EAAE,EAAE,CACP;;YAEI,IAAI,CAAC,IAAI;MACf,IAAI,CAAC,OAAO;;;;MAIZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;;eAEjB,CACV;;EAGH,YAAY;YACV,CAAC,CAAC;UACI,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE;EAC9D,YAAY,CAAC,OAAO,EAAE;;yBAEC;YACrB,CAAC,CAAC,EACN;;;EAGE,WAAW;cACC,CAAC;IACb,CAAC;CACF,CAAA;AA1CY,wEAA8B;AAEtB;IADlB,IAAA,cAAS,EAAC,+BAAsB,CAAC;sCACS,+BAAsB;8EAAC;yCAFvD,8BAA8B;IAD1C,IAAA,eAAU,GAAE;GACA,8BAA8B,CA0C1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.sse.d.ts","sourceRoot":"","sources":["../../src/node/mcp-server.sse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-server.sse.d.ts","sourceRoot":"","sources":["../../src/node/mcp-server.sse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,qBAAa,YAAa,YAAW,UAAU;IAMC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IALtE,OAAO,CAAC,IAAI,CAAS;IACd,UAAU,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAkB;gBAErB,IAAI,EAAE,MAAM,E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KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;qCAAqE,KAAK,qBAAqB,KAAK;6BAAkD,KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;sBAAsD,KAAK,qCAAqC,KAAK;6BAAiD,KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;sBAAsD,KAAK;kBAAiD,KAAK,qCAAqC,KAAK;yBAA6C,KAAK;gCAA6C,KAAK,qBAAqB,KAAK;gCAA8C,KAAK;6BAA2C,KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;qCAAqE,KAAK,qBAAqB,KAAK;6BAAkD,KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;sBAAsD,KAAK,qCAAqC,KAAK;6BAAiD,KAAK;mCAA2D,KAAK,qBAAqB,KAAK,sCAAsC,KAAK,qBAAqB,KAAK,8BAA8B,KAAK,qCAAqC,KAAK,6BAA6B,KAAK;sBAAsD,KAAK;kBAAiD,KAAK;;IAlBjrjD,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAa5B"}
|
|
@@ -4,7 +4,6 @@ exports.SSEMCPServer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// have to import with extension since the exports map is ./* -> ./dist/cjs/*
|
|
6
6
|
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
7
|
-
const sse_js_1 = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
8
7
|
const eventsource_1 = require("eventsource");
|
|
9
8
|
const package_json_1 = tslib_1.__importDefault(require("../../package.json"));
|
|
10
9
|
global.EventSource = eventsource_1.EventSource;
|
|
@@ -27,7 +26,8 @@ class SSEMCPServer {
|
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
28
|
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(`Starting server "${this.name}" with serverHost: ${this.serverHost}`);
|
|
30
|
-
const
|
|
29
|
+
const SSEClientTransport = (await import('@modelcontextprotocol/sdk/client/sse.js')).SSEClientTransport;
|
|
30
|
+
const transport = new SSEClientTransport(new URL(this.serverHost));
|
|
31
31
|
transport.onerror = (error) => {
|
|
32
32
|
var _a;
|
|
33
33
|
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.error('Transport Error:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.sse.js","sourceRoot":"","sources":["../../src/node/mcp-server.sse.ts"],"names":[],"mappings":";;;;AAAA,6EAA6E;AAC7E,wEAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"mcp-server.sse.js","sourceRoot":"","sources":["../../src/node/mcp-server.sse.ts"],"names":[],"mappings":";;;;AAAA,6EAA6E;AAC7E,wEAAmE;AACnE,6CAA0C;AAI1C,8EAAqC;AAGrC,MAAM,CAAC,WAAW,GAAG,yBAAkB,CAAC;AACxC,MAAa,YAAY;IAMvB,YAAY,IAAY,EAAE,UAAkB,EAAmB,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;QAFvE,YAAO,GAAY,KAAK,CAAC;QAG/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IA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,KAAK,CAAC;IACvB,CAAC;CACF;AA3FD,oCA2FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-ai-native",
|
|
3
|
-
"version": "3.8.3-next-
|
|
3
|
+
"version": "3.8.3-next-1741772268.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src"
|
|
@@ -24,26 +24,26 @@
|
|
|
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-
|
|
28
|
-
"@opensumi/ide-components": "3.8.3-next-
|
|
29
|
-
"@opensumi/ide-connection": "3.8.3-next-
|
|
30
|
-
"@opensumi/ide-core-common": "3.8.3-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.8.3-next-
|
|
32
|
-
"@opensumi/ide-debug": "3.8.3-next-
|
|
33
|
-
"@opensumi/ide-design": "3.8.3-next-
|
|
34
|
-
"@opensumi/ide-editor": "3.8.3-next-
|
|
35
|
-
"@opensumi/ide-file-search": "3.8.3-next-
|
|
36
|
-
"@opensumi/ide-file-service": "3.8.3-next-
|
|
37
|
-
"@opensumi/ide-main-layout": "3.8.3-next-
|
|
38
|
-
"@opensumi/ide-markers": "3.8.3-next-
|
|
39
|
-
"@opensumi/ide-monaco": "3.8.3-next-
|
|
40
|
-
"@opensumi/ide-overlay": "3.8.3-next-
|
|
41
|
-
"@opensumi/ide-preferences": "3.8.3-next-
|
|
42
|
-
"@opensumi/ide-search": "3.8.3-next-
|
|
43
|
-
"@opensumi/ide-terminal-next": "3.8.3-next-
|
|
44
|
-
"@opensumi/ide-theme": "3.8.3-next-
|
|
45
|
-
"@opensumi/ide-utils": "3.8.3-next-
|
|
46
|
-
"@opensumi/ide-workspace": "3.8.3-next-
|
|
27
|
+
"@opensumi/ide-addons": "3.8.3-next-1741772268.0",
|
|
28
|
+
"@opensumi/ide-components": "3.8.3-next-1741772268.0",
|
|
29
|
+
"@opensumi/ide-connection": "3.8.3-next-1741772268.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.8.3-next-1741772268.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.8.3-next-1741772268.0",
|
|
32
|
+
"@opensumi/ide-debug": "3.8.3-next-1741772268.0",
|
|
33
|
+
"@opensumi/ide-design": "3.8.3-next-1741772268.0",
|
|
34
|
+
"@opensumi/ide-editor": "3.8.3-next-1741772268.0",
|
|
35
|
+
"@opensumi/ide-file-search": "3.8.3-next-1741772268.0",
|
|
36
|
+
"@opensumi/ide-file-service": "3.8.3-next-1741772268.0",
|
|
37
|
+
"@opensumi/ide-main-layout": "3.8.3-next-1741772268.0",
|
|
38
|
+
"@opensumi/ide-markers": "3.8.3-next-1741772268.0",
|
|
39
|
+
"@opensumi/ide-monaco": "3.8.3-next-1741772268.0",
|
|
40
|
+
"@opensumi/ide-overlay": "3.8.3-next-1741772268.0",
|
|
41
|
+
"@opensumi/ide-preferences": "3.8.3-next-1741772268.0",
|
|
42
|
+
"@opensumi/ide-search": "3.8.3-next-1741772268.0",
|
|
43
|
+
"@opensumi/ide-terminal-next": "3.8.3-next-1741772268.0",
|
|
44
|
+
"@opensumi/ide-theme": "3.8.3-next-1741772268.0",
|
|
45
|
+
"@opensumi/ide-utils": "3.8.3-next-1741772268.0",
|
|
46
|
+
"@opensumi/ide-workspace": "3.8.3-next-1741772268.0",
|
|
47
47
|
"@xterm/xterm": "5.5.0",
|
|
48
48
|
"ai": "^4.1.45",
|
|
49
49
|
"ansi-regex": "^2.0.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"zod-to-json-schema": "^3.24.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@opensumi/ide-core-browser": "3.8.3-next-
|
|
63
|
+
"@opensumi/ide-core-browser": "3.8.3-next-1741772268.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "c0d5729118331bd2db0a7052c0ab6f5e5b98f9da"
|
|
66
66
|
}
|
|
@@ -59,7 +59,7 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
|
|
|
59
59
|
private readonly aiReporter: IAIReporter;
|
|
60
60
|
|
|
61
61
|
@Autowired(LLMContextServiceToken)
|
|
62
|
-
protected readonly
|
|
62
|
+
protected readonly contextService: LLMContextService;
|
|
63
63
|
|
|
64
64
|
@Autowired(ChatAgentPromptProvider)
|
|
65
65
|
protected readonly promptProvider: ChatAgentPromptProvider;
|
|
@@ -74,7 +74,7 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
|
|
|
74
74
|
super();
|
|
75
75
|
this.addDispose(this._onDidChangeAgents);
|
|
76
76
|
this.addDispose(
|
|
77
|
-
this.
|
|
77
|
+
this.contextService.onDidContextFilesChangeEvent((event) => {
|
|
78
78
|
if (event.version !== this.contextVersion) {
|
|
79
79
|
this.contextVersion = event.version;
|
|
80
80
|
this.shouldUpdateContext = true;
|
|
@@ -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 =
|
|
155
|
+
request.message = this.provideContextMessage(rawMessage, request.sessionId);
|
|
156
156
|
} else if (this.shouldUpdateContext || request.regenerate || history.length === 0) {
|
|
157
|
-
request.message =
|
|
157
|
+
request.message = this.provideContextMessage(request.message, request.sessionId);
|
|
158
158
|
this.shouldUpdateContext = false;
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -162,9 +162,9 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
|
|
|
162
162
|
return result;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
private
|
|
166
|
-
const context =
|
|
167
|
-
const fullMessage =
|
|
165
|
+
private provideContextMessage(message: string, sessionId: string) {
|
|
166
|
+
const context = this.contextService.serialize();
|
|
167
|
+
const fullMessage = this.promptProvider.provideContextPrompt(context, message);
|
|
168
168
|
this.aiReporter.send({
|
|
169
169
|
msgType: AIServiceType.Chat,
|
|
170
170
|
actionType: ActionTypeEnum.ContextEnhance,
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MessageList } from 'react-chat-elements';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
AINativeConfigService,
|
|
6
|
-
AppConfig,
|
|
7
|
-
LabelService,
|
|
8
|
-
getIcon,
|
|
9
|
-
useInjectable,
|
|
10
|
-
useUpdateOnEvent,
|
|
11
|
-
} from '@opensumi/ide-core-browser';
|
|
4
|
+
import { AppConfig, getIcon, useInjectable, useUpdateOnEvent } from '@opensumi/ide-core-browser';
|
|
12
5
|
import { Popover, PopoverPosition } from '@opensumi/ide-core-browser/lib/components';
|
|
13
6
|
import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
14
7
|
import {
|
|
@@ -21,7 +14,6 @@ import {
|
|
|
21
14
|
ChatMessageRole,
|
|
22
15
|
ChatRenderRegistryToken,
|
|
23
16
|
ChatServiceToken,
|
|
24
|
-
CommandService,
|
|
25
17
|
Disposable,
|
|
26
18
|
DisposableCollection,
|
|
27
19
|
IAIReporter,
|
|
@@ -36,18 +28,16 @@ import {
|
|
|
36
28
|
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
37
29
|
import { IMainLayoutService } from '@opensumi/ide-main-layout';
|
|
38
30
|
import { IMessageService } from '@opensumi/ide-overlay';
|
|
39
|
-
import 'react-chat-elements/dist/main.css';
|
|
40
|
-
import { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
41
31
|
|
|
32
|
+
import 'react-chat-elements/dist/main.css';
|
|
42
33
|
import { AI_CHAT_VIEW_ID, IChatAgentService, IChatInternalService, IChatMessageStructure } from '../../common';
|
|
43
|
-
import { LLMContextService, LLMContextServiceToken } from '../../common/llm-context';
|
|
44
34
|
import { CodeBlockData } from '../../common/types';
|
|
45
35
|
import { FileChange, FileListDisplay } from '../components/ChangeList';
|
|
36
|
+
import { ChatContext } from '../components/ChatContext';
|
|
46
37
|
import { CodeBlockWrapperInput } from '../components/ChatEditor';
|
|
47
38
|
import ChatHistory, { IChatHistoryItem } from '../components/ChatHistory';
|
|
48
39
|
import { ChatInput } from '../components/ChatInput';
|
|
49
40
|
import { ChatMarkdown } from '../components/ChatMarkdown';
|
|
50
|
-
import { ChatMentionInput } from '../components/ChatMentionInput';
|
|
51
41
|
import { ChatNotify, ChatReply } from '../components/ChatReply';
|
|
52
42
|
import { SlashCustomRender } from '../components/SlashCustomRender';
|
|
53
43
|
import { MessageData, createMessageByAI, createMessageByUser } from '../components/utils';
|
|
@@ -115,8 +105,6 @@ export const AIChatView = () => {
|
|
|
115
105
|
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
116
106
|
const chatRenderRegistry = useInjectable<ChatRenderRegistry>(ChatRenderRegistryToken);
|
|
117
107
|
const mcpServerRegistry = useInjectable<IMCPServerRegistry>(TokenMCPServerRegistry);
|
|
118
|
-
const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
|
|
119
|
-
const llmContextService = useInjectable<LLMContextService>(LLMContextServiceToken);
|
|
120
108
|
|
|
121
109
|
const layoutService = useInjectable<IMainLayoutService>(IMainLayoutService);
|
|
122
110
|
const msgHistoryManager = aiChatService.sessionModel.history;
|
|
@@ -126,9 +114,6 @@ export const AIChatView = () => {
|
|
|
126
114
|
const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
|
|
127
115
|
const appConfig = useInjectable<AppConfig>(AppConfig);
|
|
128
116
|
const applyService = useInjectable<BaseApplyService>(BaseApplyService);
|
|
129
|
-
const labelService = useInjectable<LabelService>(LabelService);
|
|
130
|
-
const workspaceService = useInjectable<IWorkspaceService>(IWorkspaceService);
|
|
131
|
-
const commandService = useInjectable<CommandService>(CommandService);
|
|
132
117
|
const [shortcutCommands, setShortcutCommands] = React.useState<ChatSlashCommandItemModel[]>([]);
|
|
133
118
|
|
|
134
119
|
const [changeList, setChangeList] = React.useState<FileChange[]>(getFileChanges(applyService.getSessionCodeBlocks()));
|
|
@@ -199,9 +184,6 @@ export const AIChatView = () => {
|
|
|
199
184
|
if (chatRenderRegistry.chatInputRender) {
|
|
200
185
|
return chatRenderRegistry.chatInputRender;
|
|
201
186
|
}
|
|
202
|
-
if (aiNativeConfigService.capabilities.supportsMCP) {
|
|
203
|
-
return ChatMentionInput;
|
|
204
|
-
}
|
|
205
187
|
return ChatInput;
|
|
206
188
|
}, [chatRenderRegistry.chatInputRender]);
|
|
207
189
|
|
|
@@ -280,7 +262,7 @@ export const AIChatView = () => {
|
|
|
280
262
|
if (loading) {
|
|
281
263
|
return;
|
|
282
264
|
}
|
|
283
|
-
await handleSend(message
|
|
265
|
+
await handleSend(message);
|
|
284
266
|
} else {
|
|
285
267
|
if (message.agentId) {
|
|
286
268
|
setAgentId(message.agentId);
|
|
@@ -367,9 +349,6 @@ export const AIChatView = () => {
|
|
|
367
349
|
text={message}
|
|
368
350
|
agentId={visibleAgentId}
|
|
369
351
|
command={command}
|
|
370
|
-
labelService={labelService}
|
|
371
|
-
workspaceService={workspaceService}
|
|
372
|
-
commandService={commandService}
|
|
373
352
|
/>
|
|
374
353
|
),
|
|
375
354
|
},
|
|
@@ -475,15 +454,7 @@ export const AIChatView = () => {
|
|
|
475
454
|
text: ChatUserRoleRender ? (
|
|
476
455
|
<ChatUserRoleRender content={message} agentId={visibleAgentId} command={command} />
|
|
477
456
|
) : (
|
|
478
|
-
<CodeBlockWrapperInput
|
|
479
|
-
labelService={labelService}
|
|
480
|
-
relationId={relationId}
|
|
481
|
-
text={message}
|
|
482
|
-
agentId={visibleAgentId}
|
|
483
|
-
command={command}
|
|
484
|
-
workspaceService={workspaceService}
|
|
485
|
-
commandService={commandService}
|
|
486
|
-
/>
|
|
457
|
+
<CodeBlockWrapperInput relationId={relationId} text={message} agentId={visibleAgentId} command={command} />
|
|
487
458
|
),
|
|
488
459
|
},
|
|
489
460
|
styles.chat_message_code,
|
|
@@ -667,46 +638,11 @@ export const AIChatView = () => {
|
|
|
667
638
|
);
|
|
668
639
|
|
|
669
640
|
const handleSend = React.useCallback(
|
|
670
|
-
async (
|
|
671
|
-
const reportExtra =
|
|
672
|
-
actionSource: ActionSourceEnum.Chat,
|
|
673
|
-
actionType: ActionTypeEnum.Send,
|
|
674
|
-
};
|
|
675
|
-
agentId = agentId ? agentId : ChatProxyService.AGENT_ID;
|
|
676
|
-
// 提取并替换 {{@file:xxx}} 中的文件内容
|
|
677
|
-
let processedContent = message;
|
|
678
|
-
const filePattern = /\{\{@file:(.*?)\}\}/g;
|
|
679
|
-
const fileMatches = message.match(filePattern);
|
|
680
|
-
let isCleanContext = false;
|
|
681
|
-
if (fileMatches) {
|
|
682
|
-
for (const match of fileMatches) {
|
|
683
|
-
const filePath = match.replace(/\{\{@file:(.*?)\}\}/, '$1');
|
|
684
|
-
if (filePath && !isCleanContext) {
|
|
685
|
-
isCleanContext = true;
|
|
686
|
-
llmContextService.cleanFileContext();
|
|
687
|
-
}
|
|
688
|
-
const fileUri = new URI(filePath);
|
|
689
|
-
llmContextService.addFileToContext(fileUri, undefined, true);
|
|
690
|
-
const relativePath = (await workspaceService.asRelativePath(fileUri))?.path || fileUri.displayName;
|
|
691
|
-
// 获取文件内容
|
|
692
|
-
// 替换占位符,后续支持自定义渲染时可替换为自定义渲染标签
|
|
693
|
-
processedContent = processedContent.replace(match, `\`<attached_file>${relativePath}\``);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
641
|
+
async (value: IChatMessageStructure) => {
|
|
642
|
+
const { message, command, reportExtra } = value;
|
|
696
643
|
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
if (folderMatches) {
|
|
700
|
-
for (const match of folderMatches) {
|
|
701
|
-
const folderPath = match.replace(/\{\{@folder:(.*?)\}\}/, '$1');
|
|
702
|
-
const folderUri = new URI(folderPath);
|
|
703
|
-
llmContextService.addFolderToContext(folderUri);
|
|
704
|
-
const relativePath = (await workspaceService.asRelativePath(folderUri))?.path || folderUri.displayName;
|
|
705
|
-
// 替换占位符,后续支持自定义渲染时可替换为自定义渲染标签
|
|
706
|
-
processedContent = processedContent.replace(match, `\`<attached_folder>${relativePath}\``);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
return handleAgentReply({ message: processedContent, agentId, command, reportExtra });
|
|
644
|
+
const agentId = value.agentId ? value.agentId : ChatProxyService.AGENT_ID;
|
|
645
|
+
return handleAgentReply({ message, agentId, command, reportExtra });
|
|
710
646
|
},
|
|
711
647
|
[handleAgentReply],
|
|
712
648
|
);
|
|
@@ -823,6 +759,7 @@ export const AIChatView = () => {
|
|
|
823
759
|
</div>
|
|
824
760
|
) : null}
|
|
825
761
|
<div className={styles.chat_input_wrap}>
|
|
762
|
+
<ChatContext />
|
|
826
763
|
<div className={styles.header_operate}>
|
|
827
764
|
<div className={styles.header_operate_left}>
|
|
828
765
|
{shortcutCommands.map((command) => (
|
|
@@ -853,7 +790,17 @@ export const AIChatView = () => {
|
|
|
853
790
|
/>
|
|
854
791
|
)}
|
|
855
792
|
<ChatInputWrapperRender
|
|
856
|
-
onSend={
|
|
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
|
+
}
|
|
857
804
|
disabled={loading}
|
|
858
805
|
enableOptions={true}
|
|
859
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 './
|
|
18
|
+
import { ContextSelector } from './ContextSelector';
|
|
19
19
|
import styles from './style.module.less';
|
|
20
20
|
|
|
21
21
|
const getCollapsedHeight = () => ({ height: 0, opacity: 0 });
|
|
@@ -2,24 +2,14 @@ import capitalize from 'lodash/capitalize';
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import Highlight from 'react-highlight';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
FILE_COMMANDS,
|
|
8
|
-
IClipboardService,
|
|
9
|
-
LabelService,
|
|
10
|
-
getIcon,
|
|
11
|
-
useInjectable,
|
|
12
|
-
uuid,
|
|
13
|
-
} from '@opensumi/ide-core-browser';
|
|
14
|
-
import { Icon, Popover } from '@opensumi/ide-core-browser/lib/components';
|
|
5
|
+
import { IClipboardService, getIcon, useInjectable, uuid } from '@opensumi/ide-core-browser';
|
|
6
|
+
import { Popover } from '@opensumi/ide-core-browser/lib/components';
|
|
15
7
|
import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
16
8
|
import {
|
|
17
9
|
ActionSourceEnum,
|
|
18
10
|
ActionTypeEnum,
|
|
19
11
|
ChatFeatureRegistryToken,
|
|
20
|
-
CommandService,
|
|
21
12
|
IAIReporter,
|
|
22
|
-
URI,
|
|
23
13
|
localize,
|
|
24
14
|
runWhenIdle,
|
|
25
15
|
} from '@opensumi/ide-core-common';
|
|
@@ -32,9 +22,6 @@ import { ChatFeatureRegistry } from '../chat/chat.feature.registry';
|
|
|
32
22
|
|
|
33
23
|
import styles from './components.module.less';
|
|
34
24
|
import { highLightLanguageSupport } from './highLight';
|
|
35
|
-
import { MentionType } from './mention-input/types';
|
|
36
|
-
|
|
37
|
-
import type { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
38
25
|
|
|
39
26
|
import './highlightTheme.less';
|
|
40
27
|
|
|
@@ -152,56 +139,16 @@ const CodeBlock = ({
|
|
|
152
139
|
renderText,
|
|
153
140
|
agentId = '',
|
|
154
141
|
command = '',
|
|
155
|
-
labelService,
|
|
156
|
-
commandService,
|
|
157
|
-
workspaceService,
|
|
158
142
|
}: {
|
|
159
143
|
content?: string;
|
|
160
144
|
relationId: string;
|
|
161
145
|
renderText?: (t: string) => React.ReactNode;
|
|
162
146
|
agentId?: string;
|
|
163
147
|
command?: string;
|
|
164
|
-
labelService?: LabelService;
|
|
165
|
-
commandService?: CommandService;
|
|
166
|
-
workspaceService?: IWorkspaceService;
|
|
167
148
|
}) => {
|
|
168
149
|
const rgInlineCode = /`([^`]+)`/g;
|
|
169
150
|
const rgBlockCode = /```([^]+?)```/g;
|
|
170
151
|
const rgBlockCodeBefore = /```([^]+)?/g;
|
|
171
|
-
const rgAttachedFile = /<attached_file>(.*)/g;
|
|
172
|
-
const rgAttachedFolder = /<attached_folder>(.*)/g;
|
|
173
|
-
const handleAttachmentClick = useCallback(
|
|
174
|
-
async (text: string, type: MentionType) => {
|
|
175
|
-
const roots = await workspaceService?.roots;
|
|
176
|
-
let uri;
|
|
177
|
-
if (!roots) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
for (const root of roots) {
|
|
181
|
-
uri = new URI(root.uri).resolve(text);
|
|
182
|
-
try {
|
|
183
|
-
await commandService?.executeCommand(FILE_COMMANDS.LOCATION.id, uri);
|
|
184
|
-
if (type === MentionType.FILE) {
|
|
185
|
-
await commandService?.executeCommand(EDITOR_COMMANDS.OPEN_RESOURCE.id, uri);
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
} catch {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
[commandService, workspaceService],
|
|
194
|
-
);
|
|
195
|
-
const renderAttachment = (text: string, isFolder = false, key: string) => (
|
|
196
|
-
<span
|
|
197
|
-
className={styles.attachment}
|
|
198
|
-
key={key}
|
|
199
|
-
onClick={() => handleAttachmentClick(text, isFolder ? MentionType.FOLDER : MentionType.FILE)}
|
|
200
|
-
>
|
|
201
|
-
<Icon iconClass={isFolder ? getIcon('folder') : labelService?.getIcon(new URI(text || 'file'))} />
|
|
202
|
-
<span className={styles.attachment_text}>{text}</span>
|
|
203
|
-
</span>
|
|
204
|
-
);
|
|
205
152
|
|
|
206
153
|
const renderCodeEditor = (content: string) => {
|
|
207
154
|
const language = content.split('\n')[0].trim().toLowerCase();
|
|
@@ -246,47 +193,11 @@ const CodeBlock = ({
|
|
|
246
193
|
renderedContent.push(text);
|
|
247
194
|
}
|
|
248
195
|
} else {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
let lastIndex = 0;
|
|
255
|
-
const fragments: (string | React.ReactNode)[] = [];
|
|
256
|
-
|
|
257
|
-
// 处理文件标记
|
|
258
|
-
fileMatches.forEach((match, matchIndex) => {
|
|
259
|
-
if (match.index !== undefined) {
|
|
260
|
-
const spanText = processedText.slice(lastIndex, match.index);
|
|
261
|
-
if (spanText) {
|
|
262
|
-
fragments.push(<span key={`${index}-${matchIndex}`}>{spanText}</span>);
|
|
263
|
-
}
|
|
264
|
-
fragments.push(renderAttachment(match[1], false, `${index}-tag-${matchIndex}`));
|
|
265
|
-
lastIndex = match.index + match[0].length;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
// 处理文件夹标记
|
|
270
|
-
folderMatches.forEach((match, matchIndex) => {
|
|
271
|
-
if (match.index !== undefined) {
|
|
272
|
-
const spanText = processedText.slice(lastIndex, match.index);
|
|
273
|
-
if (spanText) {
|
|
274
|
-
fragments.push(<span key={`${index}-${matchIndex}`}>{spanText}</span>);
|
|
275
|
-
}
|
|
276
|
-
fragments.push(renderAttachment(match[1], true, `${index}-tag-${matchIndex}`));
|
|
277
|
-
lastIndex = match.index + match[0].length;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
fragments.push(processedText.slice(lastIndex));
|
|
282
|
-
renderedContent.push(...fragments);
|
|
283
|
-
} else {
|
|
284
|
-
renderedContent.push(
|
|
285
|
-
<span className={styles.code_inline} key={index}>
|
|
286
|
-
{text}
|
|
287
|
-
</span>,
|
|
288
|
-
);
|
|
289
|
-
}
|
|
196
|
+
renderedContent.push(
|
|
197
|
+
<span className={styles.code_inline} key={index}>
|
|
198
|
+
{text}
|
|
199
|
+
</span>,
|
|
200
|
+
);
|
|
290
201
|
}
|
|
291
202
|
});
|
|
292
203
|
} else {
|
|
@@ -305,29 +216,15 @@ export const CodeBlockWrapper = ({
|
|
|
305
216
|
renderText,
|
|
306
217
|
relationId,
|
|
307
218
|
agentId,
|
|
308
|
-
labelService,
|
|
309
|
-
commandService,
|
|
310
|
-
workspaceService,
|
|
311
219
|
}: {
|
|
312
220
|
text?: string;
|
|
313
221
|
relationId: string;
|
|
314
222
|
renderText?: (t: string) => React.ReactNode;
|
|
315
223
|
agentId?: string;
|
|
316
|
-
labelService?: LabelService;
|
|
317
|
-
commandService?: CommandService;
|
|
318
|
-
workspaceService?: IWorkspaceService;
|
|
319
224
|
}) => (
|
|
320
225
|
<div className={styles.ai_chat_code_wrapper}>
|
|
321
226
|
<div className={styles.render_text}>
|
|
322
|
-
<CodeBlock
|
|
323
|
-
content={text}
|
|
324
|
-
labelService={labelService}
|
|
325
|
-
renderText={renderText}
|
|
326
|
-
relationId={relationId}
|
|
327
|
-
agentId={agentId}
|
|
328
|
-
commandService={commandService}
|
|
329
|
-
workspaceService={workspaceService}
|
|
330
|
-
/>
|
|
227
|
+
<CodeBlock content={text} renderText={renderText} relationId={relationId} agentId={agentId} />
|
|
331
228
|
</div>
|
|
332
229
|
</div>
|
|
333
230
|
);
|
|
@@ -337,17 +234,11 @@ export const CodeBlockWrapperInput = ({
|
|
|
337
234
|
relationId,
|
|
338
235
|
agentId,
|
|
339
236
|
command,
|
|
340
|
-
labelService,
|
|
341
|
-
workspaceService,
|
|
342
|
-
commandService,
|
|
343
237
|
}: {
|
|
344
238
|
text: string;
|
|
345
239
|
relationId: string;
|
|
346
240
|
agentId?: string;
|
|
347
241
|
command?: string;
|
|
348
|
-
labelService?: LabelService;
|
|
349
|
-
workspaceService?: IWorkspaceService;
|
|
350
|
-
commandService?: CommandService;
|
|
351
242
|
}) => {
|
|
352
243
|
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
353
244
|
const [tag, setTag] = useState<string>('');
|
|
@@ -380,15 +271,7 @@ export const CodeBlockWrapperInput = ({
|
|
|
380
271
|
</div>
|
|
381
272
|
)}
|
|
382
273
|
{command && <div className={styles.tag}>/ {command}</div>}
|
|
383
|
-
<CodeBlock
|
|
384
|
-
content={txt}
|
|
385
|
-
labelService={labelService}
|
|
386
|
-
relationId={relationId}
|
|
387
|
-
agentId={agentId}
|
|
388
|
-
command={command}
|
|
389
|
-
workspaceService={workspaceService}
|
|
390
|
-
commandService={commandService}
|
|
391
|
-
/>
|
|
274
|
+
<CodeBlock content={txt} relationId={relationId} agentId={agentId} command={command} />
|
|
392
275
|
</div>
|
|
393
276
|
</div>
|
|
394
277
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
import { EnhanceIcon, Thumbs } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
5
6
|
import { Progress } from '@opensumi/ide-core-browser/lib/progress/progress-bar';
|
|
6
7
|
import { ChatRenderRegistryToken, isUndefined, localize } from '@opensumi/ide-core-common';
|
|
@@ -12,7 +13,7 @@ import { ChatRenderRegistry } from '../chat/chat.render.registry';
|
|
|
12
13
|
import styles from './components.module.less';
|
|
13
14
|
|
|
14
15
|
interface ITinkingProps {
|
|
15
|
-
children?: React.ReactNode
|
|
16
|
+
children?: React.ReactNode;
|
|
16
17
|
hasMessage?: boolean;
|
|
17
18
|
message?: string;
|
|
18
19
|
onRegenerate?: () => void;
|
|
@@ -31,15 +32,8 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
31
32
|
[chatRenderRegistry, chatRenderRegistry.chatThinkingRender],
|
|
32
33
|
);
|
|
33
34
|
|
|
34
|
-
const isEmptyChildren = useMemo(() => {
|
|
35
|
-
if (Array.isArray(children)) {
|
|
36
|
-
return children.length === 0;
|
|
37
|
-
}
|
|
38
|
-
return !children;
|
|
39
|
-
}, [children]);
|
|
40
|
-
|
|
41
35
|
const renderContent = useCallback(() => {
|
|
42
|
-
if (
|
|
36
|
+
if (!children) {
|
|
43
37
|
if (CustomThinkingRender) {
|
|
44
38
|
return <CustomThinkingRender thinkingText={thinkingText} />;
|
|
45
39
|
}
|
|
@@ -58,7 +52,7 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
58
52
|
{!CustomThinkingRender && (
|
|
59
53
|
<span className={styles.progress_bar}>
|
|
60
54
|
{/* 保持动画效果一致 */}
|
|
61
|
-
{
|
|
55
|
+
{!children && <Progress loading={true} wrapperClassName={styles.ai_native_progress_wrapper} />}
|
|
62
56
|
</span>
|
|
63
57
|
)}
|
|
64
58
|
{/* {showStop && (
|