@opensumi/ide-ai-native 3.8.1-next-1741250387.0 → 3.8.1-next-1741251026.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.contextkeys.d.ts +1 -1
- package/lib/browser/ai-core.contextkeys.d.ts.map +1 -1
- package/lib/browser/ai-core.contextkeys.js +1 -1
- package/lib/browser/ai-core.contextkeys.js.map +1 -1
- package/lib/browser/ai-core.contribution.d.ts +5 -0
- package/lib/browser/ai-core.contribution.d.ts.map +1 -1
- package/lib/browser/ai-core.contribution.js +71 -9
- package/lib/browser/ai-core.contribution.js.map +1 -1
- package/lib/browser/chat/chat-agent.service.d.ts +11 -3
- package/lib/browser/chat/chat-agent.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-agent.service.js +43 -5
- package/lib/browser/chat/chat-agent.service.js.map +1 -1
- package/lib/browser/chat/chat-manager.service.d.ts +1 -0
- package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-manager.service.js +6 -8
- package/lib/browser/chat/chat-manager.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts +4 -1
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +57 -2
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-proxy.service.js +13 -6
- package/lib/browser/chat/chat-proxy.service.js.map +1 -1
- package/lib/browser/chat/chat.api.service.d.ts +1 -2
- package/lib/browser/chat/chat.api.service.d.ts.map +1 -1
- package/lib/browser/chat/chat.api.service.js +0 -4
- package/lib/browser/chat/chat.api.service.js.map +1 -1
- package/lib/browser/chat/chat.internal.service.d.ts +2 -0
- package/lib/browser/chat/chat.internal.service.d.ts.map +1 -1
- package/lib/browser/chat/chat.internal.service.js +3 -0
- package/lib/browser/chat/chat.internal.service.js.map +1 -1
- package/lib/browser/chat/chat.module.less +1 -2
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +46 -29
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatContext/index.js +2 -2
- package/lib/browser/components/ChatContext/index.js.map +1 -1
- package/lib/browser/components/ChatInput.d.ts.map +1 -1
- package/lib/browser/components/ChatInput.js +29 -1
- package/lib/browser/components/ChatInput.js.map +1 -1
- package/lib/browser/components/ChatReply.js +6 -1
- package/lib/browser/components/ChatReply.js.map +1 -1
- package/lib/browser/components/ChatThinking.d.ts +0 -2
- package/lib/browser/components/ChatThinking.d.ts.map +1 -1
- package/lib/browser/components/ChatThinking.js +2 -10
- package/lib/browser/components/ChatThinking.js.map +1 -1
- package/lib/browser/components/ChatToolRender.d.ts.map +1 -1
- package/lib/browser/components/ChatToolRender.js +2 -3
- package/lib/browser/components/ChatToolRender.js.map +1 -1
- package/lib/browser/components/WelcomeMsg.js +1 -1
- package/lib/browser/components/WelcomeMsg.js.map +1 -1
- package/lib/browser/components/chat-history.module.less +2 -1
- package/lib/browser/components/components.module.less +22 -0
- package/lib/browser/context/llm-context.service.d.ts +18 -5
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js +80 -47
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/browser/contrib/inline-completions/inline-completions.controller.js +1 -1
- package/lib/browser/contrib/inline-completions/inline-completions.controller.js.map +1 -1
- package/lib/browser/contrib/inline-completions/prompt/matcher.js +2 -2
- package/lib/browser/contrib/inline-completions/prompt/similarSnippets.d.ts +1 -1
- package/lib/browser/contrib/inline-completions/prompt/similarSnippets.js +2 -2
- package/lib/browser/contrib/intelligent-completions/index.d.ts +2 -1
- package/lib/browser/contrib/intelligent-completions/index.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/index.js +4 -1
- package/lib/browser/contrib/intelligent-completions/index.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js +2 -2
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js +6 -5
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.js +4 -2
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/default.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/default.js +23 -11
- package/lib/browser/contrib/intelligent-completions/view/default.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +4 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/layout/layout.module.less +4 -4
- package/lib/browser/mcp/base-apply.service.d.ts +26 -11
- package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
- package/lib/browser/mcp/base-apply.service.js +255 -103
- package/lib/browser/mcp/base-apply.service.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.module.less +178 -0
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts +3 -0
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -0
- package/lib/browser/mcp/config/components/mcp-config.view.js +150 -0
- package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -0
- package/lib/browser/mcp/config/components/mcp-server-form.d.ts +16 -0
- package/lib/browser/mcp/config/components/mcp-server-form.d.ts.map +1 -0
- package/lib/browser/mcp/config/components/mcp-server-form.js +84 -0
- package/lib/browser/mcp/config/components/mcp-server-form.js.map +1 -0
- package/lib/browser/mcp/config/components/mcp-server-form.module.less +78 -0
- package/lib/browser/mcp/config/mcp-config.commands.d.ts +10 -0
- package/lib/browser/mcp/config/mcp-config.commands.d.ts.map +1 -0
- package/lib/browser/mcp/config/mcp-config.commands.js +35 -0
- package/lib/browser/mcp/config/mcp-config.commands.js.map +1 -0
- package/lib/browser/mcp/config/mcp-config.contribution.d.ts +16 -0
- package/lib/browser/mcp/config/mcp-config.contribution.d.ts.map +1 -0
- package/lib/browser/mcp/config/mcp-config.contribution.js +62 -0
- package/lib/browser/mcp/config/mcp-config.contribution.js.map +1 -0
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts +6 -0
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts.map +1 -1
- package/lib/browser/mcp/mcp-server-proxy.service.js +10 -1
- package/lib/browser/mcp/mcp-server-proxy.service.js.map +1 -1
- package/lib/browser/mcp/mcp-server.feature.registry.d.ts +8 -0
- package/lib/browser/mcp/mcp-server.feature.registry.d.ts.map +1 -1
- package/lib/browser/mcp/mcp-server.feature.registry.js +28 -3
- package/lib/browser/mcp/mcp-server.feature.registry.js.map +1 -1
- package/lib/browser/mcp/tools/components/EditFile.d.ts.map +1 -1
- package/lib/browser/mcp/tools/components/EditFile.js +15 -9
- package/lib/browser/mcp/tools/components/EditFile.js.map +1 -1
- package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts +13 -0
- package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts.map +1 -0
- package/lib/browser/mcp/tools/components/{SearchResult.js → ExpandableFileList.js} +29 -19
- package/lib/browser/mcp/tools/components/ExpandableFileList.js.map +1 -0
- package/lib/browser/mcp/tools/components/Terminal.d.ts.map +1 -1
- package/lib/browser/mcp/tools/components/Terminal.js +10 -2
- package/lib/browser/mcp/tools/components/Terminal.js.map +1 -1
- package/lib/browser/mcp/tools/components/index.module.less +4 -0
- package/lib/browser/mcp/tools/createNewFileWithText.d.ts +1 -0
- package/lib/browser/mcp/tools/createNewFileWithText.d.ts.map +1 -1
- package/lib/browser/mcp/tools/createNewFileWithText.js +19 -11
- package/lib/browser/mcp/tools/createNewFileWithText.js.map +1 -1
- package/lib/browser/mcp/tools/fileSearch.d.ts +1 -0
- package/lib/browser/mcp/tools/fileSearch.d.ts.map +1 -1
- package/lib/browser/mcp/tools/fileSearch.js +14 -5
- package/lib/browser/mcp/tools/fileSearch.js.map +1 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.d.ts.map +1 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.js +1 -0
- package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
- package/lib/browser/mcp/tools/grepSearch.d.ts.map +1 -1
- package/lib/browser/mcp/tools/grepSearch.js +6 -3
- package/lib/browser/mcp/tools/grepSearch.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/EditFile.js +1 -1
- package/lib/browser/mcp/tools/handlers/EditFile.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/ListDir.d.ts +1 -0
- package/lib/browser/mcp/tools/handlers/ListDir.d.ts.map +1 -1
- package/lib/browser/mcp/tools/handlers/ListDir.js +3 -0
- package/lib/browser/mcp/tools/handlers/ListDir.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/RunCommand.d.ts.map +1 -1
- package/lib/browser/mcp/tools/handlers/RunCommand.js +2 -0
- package/lib/browser/mcp/tools/handlers/RunCommand.js.map +1 -1
- package/lib/browser/mcp/tools/listDir.d.ts +1 -0
- package/lib/browser/mcp/tools/listDir.d.ts.map +1 -1
- package/lib/browser/mcp/tools/listDir.js +35 -4
- package/lib/browser/mcp/tools/listDir.js.map +1 -1
- package/lib/browser/mcp/tools/runTerminalCmd.d.ts.map +1 -1
- package/lib/browser/mcp/tools/runTerminalCmd.js +1 -0
- package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
- package/lib/browser/model/msg-history-manager.d.ts +2 -2
- package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
- package/lib/browser/model/msg-history-manager.js +4 -10
- package/lib/browser/model/msg-history-manager.js.map +1 -1
- package/lib/browser/preferences/schema.d.ts.map +1 -1
- package/lib/browser/preferences/schema.js +22 -2
- package/lib/browser/preferences/schema.js.map +1 -1
- package/lib/browser/types.d.ts +4 -0
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/widget/inline-chat/inline-chat-controller.d.ts.map +1 -1
- package/lib/browser/widget/inline-chat/inline-chat-controller.js +6 -1
- package/lib/browser/widget/inline-chat/inline-chat-controller.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-manager.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-manager.js +68 -8
- package/lib/browser/widget/inline-diff/inline-diff-manager.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts +10 -4
- package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-previewer.js +14 -3
- package/lib/browser/widget/inline-diff/inline-diff-previewer.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-widget.module.less +25 -4
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts +3 -3
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.js +10 -5
- package/lib/browser/widget/inline-diff/inline-diff.controller.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts +46 -17
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js +110 -53
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts +4 -0
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +26 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
- package/lib/common/index.d.ts +13 -4
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +5 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/llm-context.d.ts +13 -9
- package/lib/common/llm-context.d.ts.map +1 -1
- package/lib/common/llm-context.js.map +1 -1
- package/lib/common/mcp-server-manager.d.ts +17 -1
- package/lib/common/mcp-server-manager.d.ts.map +1 -1
- package/lib/common/mcp-server-manager.js.map +1 -1
- package/lib/common/model.d.ts +12 -0
- package/lib/common/model.d.ts.map +1 -0
- package/lib/common/model.js +83 -0
- package/lib/common/model.js.map +1 -0
- package/lib/common/prompts/context-prompt-provider.d.ts +4 -3
- package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
- package/lib/common/prompts/context-prompt-provider.js +33 -22
- package/lib/common/prompts/context-prompt-provider.js.map +1 -1
- package/lib/common/tool-invocation-registry.d.ts +2 -2
- package/lib/common/tool-invocation-registry.d.ts.map +1 -1
- package/lib/common/tool-invocation-registry.js +1 -1
- package/lib/common/tool-invocation-registry.js.map +1 -1
- package/lib/common/types.d.ts +8 -0
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +2 -1
- package/lib/common/utils.js.map +1 -1
- package/lib/node/anthropic/anthropic-language-model.d.ts +3 -1
- package/lib/node/anthropic/anthropic-language-model.d.ts.map +1 -1
- package/lib/node/anthropic/anthropic-language-model.js +6 -2
- package/lib/node/anthropic/anthropic-language-model.js.map +1 -1
- package/lib/node/base-language-model.d.ts +6 -3
- package/lib/node/base-language-model.d.ts.map +1 -1
- package/lib/node/base-language-model.js +14 -31
- package/lib/node/base-language-model.js.map +1 -1
- package/lib/node/deepseek/deepseek-language-model.d.ts +3 -1
- package/lib/node/deepseek/deepseek-language-model.d.ts.map +1 -1
- package/lib/node/deepseek/deepseek-language-model.js +6 -2
- package/lib/node/deepseek/deepseek-language-model.js.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.d.ts +17 -3
- package/lib/node/mcp/sumi-mcp-server.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.js +59 -6
- package/lib/node/mcp/sumi-mcp-server.js.map +1 -1
- package/lib/node/mcp-server-manager-impl.d.ts +4 -3
- package/lib/node/mcp-server-manager-impl.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-impl.js +26 -6
- package/lib/node/mcp-server-manager-impl.js.map +1 -1
- package/lib/node/mcp-server.d.ts +5 -16
- package/lib/node/mcp-server.d.ts.map +1 -1
- package/lib/node/mcp-server.js +12 -6
- package/lib/node/mcp-server.js.map +1 -1
- package/lib/node/openai/openai-language-model.d.ts +4 -2
- package/lib/node/openai/openai-language-model.d.ts.map +1 -1
- package/lib/node/openai/openai-language-model.js +6 -4
- package/lib/node/openai/openai-language-model.js.map +1 -1
- package/lib/node/openai-compatible/openai-compatible-language-model.d.ts +10 -0
- package/lib/node/openai-compatible/openai-compatible-language-model.d.ts.map +1 -0
- package/lib/node/openai-compatible/openai-compatible-language-model.js +32 -0
- package/lib/node/openai-compatible/openai-compatible-language-model.js.map +1 -0
- package/package.json +27 -26
- package/src/browser/ai-core.contextkeys.ts +3 -3
- package/src/browser/ai-core.contribution.ts +89 -12
- package/src/browser/chat/chat-agent.service.ts +53 -9
- package/src/browser/chat/chat-manager.service.ts +10 -8
- package/src/browser/chat/chat-model.ts +63 -5
- package/src/browser/chat/chat-proxy.service.ts +16 -8
- package/src/browser/chat/chat.api.service.ts +1 -5
- package/src/browser/chat/chat.internal.service.ts +4 -0
- package/src/browser/chat/chat.module.less +1 -2
- package/src/browser/chat/chat.view.tsx +63 -69
- package/src/browser/components/ChatContext/index.tsx +2 -2
- package/src/browser/components/ChatInput.tsx +81 -6
- package/src/browser/components/ChatReply.tsx +6 -6
- package/src/browser/components/ChatThinking.tsx +3 -9
- package/src/browser/components/ChatToolRender.tsx +1 -2
- package/src/browser/components/WelcomeMsg.tsx +1 -1
- package/src/browser/components/chat-history.module.less +2 -1
- package/src/browser/components/components.module.less +22 -0
- package/src/browser/context/llm-context.service.ts +93 -54
- package/src/browser/contrib/inline-completions/inline-completions.controller.ts +1 -1
- package/src/browser/contrib/inline-completions/prompt/matcher.ts +2 -2
- package/src/browser/contrib/inline-completions/prompt/similarSnippets.ts +2 -2
- package/src/browser/contrib/intelligent-completions/index.ts +5 -1
- package/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts +3 -3
- package/src/browser/contrib/intelligent-completions/intelligent-completions.controller.ts +7 -6
- package/src/browser/contrib/intelligent-completions/view/code-edits-previewer.ts +4 -2
- package/src/browser/contrib/intelligent-completions/view/default.ts +34 -19
- package/src/browser/index.ts +4 -0
- package/src/browser/layout/layout.module.less +4 -4
- package/src/browser/mcp/base-apply.service.ts +306 -109
- package/src/browser/mcp/config/components/mcp-config.module.less +178 -0
- package/src/browser/mcp/config/components/mcp-config.view.tsx +215 -0
- package/src/browser/mcp/config/components/mcp-server-form.module.less +78 -0
- package/src/browser/mcp/config/components/mcp-server-form.tsx +144 -0
- package/src/browser/mcp/config/mcp-config.commands.ts +29 -0
- package/src/browser/mcp/config/mcp-config.contribution.ts +65 -0
- package/src/browser/mcp/mcp-server-proxy.service.ts +14 -2
- package/src/browser/mcp/mcp-server.feature.registry.ts +35 -4
- package/src/browser/mcp/tools/components/EditFile.tsx +16 -9
- package/src/browser/mcp/tools/components/ExpandableFileList.tsx +133 -0
- package/src/browser/mcp/tools/components/Terminal.tsx +13 -2
- package/src/browser/mcp/tools/components/index.module.less +4 -0
- package/src/browser/mcp/tools/createNewFileWithText.ts +21 -12
- package/src/browser/mcp/tools/fileSearch.ts +14 -4
- package/src/browser/mcp/tools/getDiagnosticsByPath.ts +1 -0
- package/src/browser/mcp/tools/grepSearch.ts +6 -3
- package/src/browser/mcp/tools/handlers/EditFile.ts +1 -1
- package/src/browser/mcp/tools/handlers/ListDir.ts +4 -0
- package/src/browser/mcp/tools/handlers/RunCommand.ts +2 -0
- package/src/browser/mcp/tools/listDir.ts +36 -5
- package/src/browser/mcp/tools/runTerminalCmd.ts +1 -0
- package/src/browser/model/msg-history-manager.ts +5 -11
- package/src/browser/preferences/schema.ts +22 -2
- package/src/browser/types.ts +1 -0
- package/src/browser/widget/inline-chat/inline-chat-controller.ts +5 -1
- package/src/browser/widget/inline-diff/inline-diff-manager.tsx +143 -21
- package/src/browser/widget/inline-diff/inline-diff-previewer.ts +25 -7
- package/src/browser/widget/inline-diff/inline-diff-widget.module.less +25 -4
- package/src/browser/widget/inline-diff/inline-diff.controller.ts +16 -8
- package/src/browser/widget/inline-stream-diff/inline-stream-diff.handler.tsx +139 -68
- package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +30 -1
- package/src/common/index.ts +15 -4
- package/src/common/llm-context.ts +10 -4
- package/src/common/mcp-server-manager.ts +17 -1
- package/src/common/model.ts +90 -0
- package/src/common/prompts/context-prompt-provider.ts +38 -29
- package/src/common/tool-invocation-registry.ts +2 -2
- package/src/common/types.ts +8 -0
- package/src/common/utils.ts +3 -1
- package/src/node/anthropic/anthropic-language-model.ts +7 -2
- package/src/node/base-language-model.ts +25 -38
- package/src/node/deepseek/deepseek-language-model.ts +7 -2
- package/src/node/mcp/sumi-mcp-server.ts +67 -9
- package/src/node/mcp-server-manager-impl.ts +30 -9
- package/src/node/mcp-server.ts +11 -14
- package/src/node/openai/openai-language-model.ts +8 -4
- package/src/node/openai-compatible/openai-compatible-language-model.ts +30 -0
- package/lib/browser/mcp/tools/components/SearchResult.d.ts +0 -11
- package/lib/browser/mcp/tools/components/SearchResult.d.ts.map +0 -1
- package/lib/browser/mcp/tools/components/SearchResult.js.map +0 -1
- package/src/browser/mcp/tools/components/SearchResult.tsx +0 -92
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MessageList } from 'react-chat-elements';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
AINativeConfigService,
|
|
6
|
-
getIcon,
|
|
7
|
-
useEventEffect,
|
|
8
|
-
useInjectable,
|
|
9
|
-
useUpdateOnEvent,
|
|
10
|
-
} from '@opensumi/ide-core-browser';
|
|
4
|
+
import { getIcon, useInjectable, useUpdateOnEvent } from '@opensumi/ide-core-browser';
|
|
11
5
|
import { Popover, PopoverPosition } from '@opensumi/ide-core-browser/lib/components';
|
|
12
6
|
import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
13
7
|
import {
|
|
@@ -25,24 +19,15 @@ import {
|
|
|
25
19
|
IAIReporter,
|
|
26
20
|
IChatComponent,
|
|
27
21
|
IChatContent,
|
|
28
|
-
MessageType,
|
|
29
22
|
formatLocalize,
|
|
30
23
|
localize,
|
|
31
24
|
uuid,
|
|
32
25
|
} from '@opensumi/ide-core-common';
|
|
33
26
|
import { IMainLayoutService } from '@opensumi/ide-main-layout';
|
|
34
|
-
import {
|
|
27
|
+
import { IMessageService } from '@opensumi/ide-overlay';
|
|
35
28
|
|
|
36
29
|
import 'react-chat-elements/dist/main.css';
|
|
37
|
-
import {
|
|
38
|
-
AI_CHAT_VIEW_ID,
|
|
39
|
-
IChatAgentService,
|
|
40
|
-
IChatInternalService,
|
|
41
|
-
IChatMessageStructure,
|
|
42
|
-
TokenMCPServerProxyService,
|
|
43
|
-
} from '../../common';
|
|
44
|
-
import { LLMContextService, LLMContextServiceToken } from '../../common/llm-context';
|
|
45
|
-
import { ChatAgentPromptProvider } from '../../common/prompts/context-prompt-provider';
|
|
30
|
+
import { AI_CHAT_VIEW_ID, IChatAgentService, IChatInternalService, IChatMessageStructure } from '../../common';
|
|
46
31
|
import { ChatContext } from '../components/ChatContext';
|
|
47
32
|
import { CodeBlockWrapperInput } from '../components/ChatEditor';
|
|
48
33
|
import ChatHistory, { IChatHistoryItem } from '../components/ChatHistory';
|
|
@@ -52,9 +37,7 @@ import { ChatNotify, ChatReply } from '../components/ChatReply';
|
|
|
52
37
|
import { SlashCustomRender } from '../components/SlashCustomRender';
|
|
53
38
|
import { MessageData, createMessageByAI, createMessageByUser } from '../components/utils';
|
|
54
39
|
import { WelcomeMessage } from '../components/WelcomeMsg';
|
|
55
|
-
import {
|
|
56
|
-
import { MCPToolsDialog } from '../mcp/mcp-tools-dialog.view';
|
|
57
|
-
import { ChatViewHeaderRender, TSlashCommandCustomRender } from '../types';
|
|
40
|
+
import { ChatViewHeaderRender, IMCPServerRegistry, TSlashCommandCustomRender, TokenMCPServerRegistry } from '../types';
|
|
58
41
|
|
|
59
42
|
import { ChatRequestModel, ChatSlashCommandItemModel } from './chat-model';
|
|
60
43
|
import { ChatProxyService } from './chat-proxy.service';
|
|
@@ -63,6 +46,7 @@ import { ChatFeatureRegistry } from './chat.feature.registry';
|
|
|
63
46
|
import { ChatInternalService } from './chat.internal.service';
|
|
64
47
|
import styles from './chat.module.less';
|
|
65
48
|
import { ChatRenderRegistry } from './chat.render.registry';
|
|
49
|
+
|
|
66
50
|
const SCROLL_CLASSNAME = 'chat_scroll';
|
|
67
51
|
|
|
68
52
|
interface TDispatchAction {
|
|
@@ -79,12 +63,12 @@ export const AIChatView = () => {
|
|
|
79
63
|
const chatAgentService = useInjectable<IChatAgentService>(IChatAgentService);
|
|
80
64
|
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
81
65
|
const chatRenderRegistry = useInjectable<ChatRenderRegistry>(ChatRenderRegistryToken);
|
|
82
|
-
const
|
|
83
|
-
const promptProvider = useInjectable<ChatAgentPromptProvider>(ChatAgentPromptProvider);
|
|
66
|
+
const mcpServerRegistry = useInjectable<IMCPServerRegistry>(TokenMCPServerRegistry);
|
|
84
67
|
|
|
85
68
|
const layoutService = useInjectable<IMainLayoutService>(IMainLayoutService);
|
|
86
69
|
const msgHistoryManager = aiChatService.sessionModel.history;
|
|
87
70
|
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
71
|
+
const autoScroll = React.useRef<boolean>(true);
|
|
88
72
|
const chatInputRef = React.useRef<{ setInputValue: (v: string) => void } | null>(null);
|
|
89
73
|
|
|
90
74
|
const [shortcutCommands, setShortcutCommands] = React.useState<ChatSlashCommandItemModel[]>([]);
|
|
@@ -156,8 +140,29 @@ export const AIChatView = () => {
|
|
|
156
140
|
[],
|
|
157
141
|
);
|
|
158
142
|
|
|
143
|
+
const onDidWheel = React.useCallback(
|
|
144
|
+
(e: WheelEvent) => {
|
|
145
|
+
// 向上滚动
|
|
146
|
+
if (e.deltaY < 0) {
|
|
147
|
+
autoScroll.current = false;
|
|
148
|
+
} else {
|
|
149
|
+
autoScroll.current = true;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
[autoScroll],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
React.useEffect(() => {
|
|
156
|
+
if (containerRef.current) {
|
|
157
|
+
containerRef.current.addEventListener('wheel', onDidWheel);
|
|
158
|
+
return () => {
|
|
159
|
+
containerRef.current?.removeEventListener('wheel', onDidWheel);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}, [autoScroll]);
|
|
163
|
+
|
|
159
164
|
const scrollToBottom = React.useCallback(() => {
|
|
160
|
-
if (containerRef && containerRef.current) {
|
|
165
|
+
if (containerRef && containerRef.current && autoScroll.current) {
|
|
161
166
|
const lastElement = containerRef.current.lastElementChild;
|
|
162
167
|
if (lastElement) {
|
|
163
168
|
lastElement.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
@@ -167,7 +172,7 @@ export const AIChatView = () => {
|
|
|
167
172
|
containerRef.current.classList.add(SCROLL_CLASSNAME);
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
|
-
}, [containerRef]);
|
|
175
|
+
}, [containerRef, autoScroll]);
|
|
171
176
|
|
|
172
177
|
const handleDispatchMessage = React.useCallback(
|
|
173
178
|
(dispatch: TDispatchAction) => {
|
|
@@ -189,7 +194,7 @@ export const AIChatView = () => {
|
|
|
189
194
|
disposer.addDispose(
|
|
190
195
|
chatApiService.onScrollToBottom(() => {
|
|
191
196
|
requestAnimationFrame(() => {
|
|
192
|
-
scrollToBottom();
|
|
197
|
+
// scrollToBottom();
|
|
193
198
|
});
|
|
194
199
|
}),
|
|
195
200
|
);
|
|
@@ -216,8 +221,9 @@ export const AIChatView = () => {
|
|
|
216
221
|
disposer.addDispose(
|
|
217
222
|
chatApiService.onChatReplyMessageLaunch((data) => {
|
|
218
223
|
if (data.kind === 'content') {
|
|
219
|
-
const relationId = aiReporter.start(AIServiceType.
|
|
224
|
+
const relationId = aiReporter.start(AIServiceType.CustomReply, {
|
|
220
225
|
message: data.content,
|
|
226
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
221
227
|
});
|
|
222
228
|
msgHistoryManager.addAssistantMessage({
|
|
223
229
|
content: data.content,
|
|
@@ -225,8 +231,9 @@ export const AIChatView = () => {
|
|
|
225
231
|
});
|
|
226
232
|
renderSimpleMarkdownReply({ chunk: data.content, relationId });
|
|
227
233
|
} else {
|
|
228
|
-
const relationId = aiReporter.start(AIServiceType.
|
|
234
|
+
const relationId = aiReporter.start(AIServiceType.CustomReply, {
|
|
229
235
|
message: 'component#' + data.component,
|
|
236
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
230
237
|
});
|
|
231
238
|
msgHistoryManager.addAssistantMessage({
|
|
232
239
|
componentId: data.component,
|
|
@@ -248,6 +255,7 @@ export const AIChatView = () => {
|
|
|
248
255
|
|
|
249
256
|
const relationId = aiReporter.start(AIServiceType.Chat, {
|
|
250
257
|
message: '',
|
|
258
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
251
259
|
});
|
|
252
260
|
|
|
253
261
|
if (role === 'assistant') {
|
|
@@ -506,10 +514,7 @@ export const AIChatView = () => {
|
|
|
506
514
|
const { message, agentId, command, reportExtra } = value;
|
|
507
515
|
const { actionType, actionSource } = reportExtra || {};
|
|
508
516
|
|
|
509
|
-
const
|
|
510
|
-
const fullMessage = await promptProvider.provideContextPrompt(context, message);
|
|
511
|
-
|
|
512
|
-
const request = aiChatService.createRequest(fullMessage, agentId!, command);
|
|
517
|
+
const request = aiChatService.createRequest(message, agentId!, command);
|
|
513
518
|
if (!request) {
|
|
514
519
|
return;
|
|
515
520
|
}
|
|
@@ -519,13 +524,19 @@ export const AIChatView = () => {
|
|
|
519
524
|
|
|
520
525
|
const startTime = Date.now();
|
|
521
526
|
const reportType = ChatProxyService.AGENT_ID === agentId ? AIServiceType.Chat : AIServiceType.Agent;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
|
|
528
|
+
const relationId = aiReporter.start(
|
|
529
|
+
command || reportType,
|
|
530
|
+
{
|
|
531
|
+
agentId,
|
|
532
|
+
userMessage: message,
|
|
533
|
+
actionType,
|
|
534
|
+
actionSource,
|
|
535
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
536
|
+
},
|
|
537
|
+
// 由于涉及 tool 调用,超时时间设置长一点
|
|
538
|
+
600 * 1000,
|
|
539
|
+
);
|
|
529
540
|
|
|
530
541
|
msgHistoryManager.addUserMessage({
|
|
531
542
|
content: message,
|
|
@@ -550,6 +561,12 @@ export const AIChatView = () => {
|
|
|
550
561
|
replyStartTime: startTime,
|
|
551
562
|
});
|
|
552
563
|
|
|
564
|
+
// 创建消息时,设置当前活跃的消息信息,便于toolCall打点
|
|
565
|
+
mcpServerRegistry.activeMessageInfo = {
|
|
566
|
+
messageId: msgId,
|
|
567
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
568
|
+
};
|
|
569
|
+
|
|
553
570
|
await renderReply({
|
|
554
571
|
startTime,
|
|
555
572
|
relationId,
|
|
@@ -735,15 +752,18 @@ export function DefaultChatViewHeader({
|
|
|
735
752
|
handleClear: () => any;
|
|
736
753
|
handleCloseChatView: () => any;
|
|
737
754
|
}) {
|
|
738
|
-
const dialogService = useInjectable<IDialogService>(IDialogService);
|
|
739
|
-
const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
|
|
740
|
-
const mcpServerProxyService = useInjectable<MCPServerProxyService>(TokenMCPServerProxyService);
|
|
741
755
|
const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
|
|
756
|
+
const messageService = useInjectable<IMessageService>(IMessageService);
|
|
757
|
+
|
|
742
758
|
const [historyList, setHistoryList] = React.useState<IChatHistoryItem[]>([]);
|
|
743
759
|
const [currentTitle, setCurrentTitle] = React.useState<string>('');
|
|
744
760
|
const handleNewChat = React.useCallback(() => {
|
|
745
761
|
if (aiChatService.sessionModel.history.getMessages().length > 0) {
|
|
746
|
-
|
|
762
|
+
try {
|
|
763
|
+
aiChatService.createSessionModel();
|
|
764
|
+
} catch (error) {
|
|
765
|
+
messageService.error(error.message);
|
|
766
|
+
}
|
|
747
767
|
}
|
|
748
768
|
}, [aiChatService]);
|
|
749
769
|
const handleHistoryItemSelect = React.useCallback(
|
|
@@ -759,15 +779,6 @@ export function DefaultChatViewHeader({
|
|
|
759
779
|
[aiChatService],
|
|
760
780
|
);
|
|
761
781
|
|
|
762
|
-
const handleShowMCPTools = React.useCallback(async () => {
|
|
763
|
-
const tools = await mcpServerProxyService.getAllMCPTools();
|
|
764
|
-
dialogService.open({
|
|
765
|
-
message: <MCPToolsDialog tools={tools} />,
|
|
766
|
-
type: MessageType.Empty,
|
|
767
|
-
buttons: ['关闭'],
|
|
768
|
-
});
|
|
769
|
-
}, [mcpServerProxyService, dialogService]);
|
|
770
|
-
|
|
771
782
|
React.useEffect(() => {
|
|
772
783
|
const getHistoryList = () => {
|
|
773
784
|
const currentMessages = aiChatService.sessionModel.history.getMessages();
|
|
@@ -847,23 +858,6 @@ export function DefaultChatViewHeader({
|
|
|
847
858
|
ariaLabel={localize('aiNative.operate.clear.title')}
|
|
848
859
|
/>
|
|
849
860
|
</Popover>
|
|
850
|
-
{aiNativeConfigService.capabilities.supportsMCP && (
|
|
851
|
-
<Popover
|
|
852
|
-
overlayClassName={styles.popover_icon}
|
|
853
|
-
id={'ai-chat-header-tools'}
|
|
854
|
-
position={PopoverPosition.left}
|
|
855
|
-
title={localize('aiNative.operate.tools.title')}
|
|
856
|
-
>
|
|
857
|
-
<EnhanceIcon
|
|
858
|
-
wrapperClassName={styles.action_btn}
|
|
859
|
-
className={getIcon('menubar-tool')}
|
|
860
|
-
onClick={handleShowMCPTools}
|
|
861
|
-
tabIndex={0}
|
|
862
|
-
role='button'
|
|
863
|
-
ariaLabel={localize('aiNative.operate.tools.title')}
|
|
864
|
-
/>
|
|
865
|
-
</Popover>
|
|
866
|
-
)}
|
|
867
861
|
<Popover
|
|
868
862
|
overlayClassName={styles.popover_icon}
|
|
869
863
|
id={'ai-chat-header-close'}
|
|
@@ -39,7 +39,7 @@ export const ChatContext = memo(() => {
|
|
|
39
39
|
50,
|
|
40
40
|
)((files) => {
|
|
41
41
|
if (files) {
|
|
42
|
-
updateAddedFiles(files);
|
|
42
|
+
updateAddedFiles([...files.attached]);
|
|
43
43
|
}
|
|
44
44
|
}, contextService);
|
|
45
45
|
|
|
@@ -57,7 +57,7 @@ export const ChatContext = memo(() => {
|
|
|
57
57
|
}, []);
|
|
58
58
|
|
|
59
59
|
const onDidDeselect = useCallback((uri: URI) => {
|
|
60
|
-
contextService.removeFileFromContext(uri);
|
|
60
|
+
contextService.removeFileFromContext(uri, true);
|
|
61
61
|
}, []);
|
|
62
62
|
|
|
63
63
|
const onDidClickFile = useCallback((uri: URI) => {
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
import cls from 'classnames';
|
|
2
2
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useInjectable, useLatest } from '@opensumi/ide-core-browser';
|
|
4
|
+
import { AINativeConfigService, useInjectable, useLatest } from '@opensumi/ide-core-browser';
|
|
5
5
|
import { Icon, Popover, PopoverPosition, getIcon } from '@opensumi/ide-core-browser/lib/components';
|
|
6
6
|
import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
7
7
|
import { InteractiveInput } from '@opensumi/ide-core-browser/lib/components/ai-native/interactive-input/index';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ChatAgentViewServiceToken,
|
|
10
|
+
ChatFeatureRegistryToken,
|
|
11
|
+
MessageType,
|
|
12
|
+
localize,
|
|
13
|
+
runWhenIdle,
|
|
14
|
+
} from '@opensumi/ide-core-common';
|
|
15
|
+
import { CommandService } from '@opensumi/ide-core-common/lib/command';
|
|
9
16
|
import { MonacoCommandRegistry } from '@opensumi/ide-editor/lib/browser/monaco-contrib/command/command.service';
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
import { IDialogService } from '@opensumi/ide-overlay';
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
AT_SIGN_SYMBOL,
|
|
21
|
+
IChatAgentService,
|
|
22
|
+
IChatInternalService,
|
|
23
|
+
SLASH_SYMBOL,
|
|
24
|
+
TokenMCPServerProxyService,
|
|
25
|
+
} from '../../common';
|
|
12
26
|
import { ChatAgentViewService } from '../chat/chat-agent.view.service';
|
|
13
27
|
import { ChatSlashCommandItemModel } from '../chat/chat-model';
|
|
14
28
|
import { ChatProxyService } from '../chat/chat-proxy.service';
|
|
15
29
|
import { ChatFeatureRegistry } from '../chat/chat.feature.registry';
|
|
30
|
+
import { ChatInternalService } from '../chat/chat.internal.service';
|
|
31
|
+
import { OPEN_MCP_CONFIG_COMMAND } from '../mcp/config/mcp-config.commands';
|
|
32
|
+
import { MCPServerProxyService } from '../mcp/mcp-server-proxy.service';
|
|
33
|
+
import { MCPToolsDialog } from '../mcp/mcp-tools-dialog.view';
|
|
16
34
|
import { IChatSlashCommandItem } from '../types';
|
|
17
35
|
|
|
18
|
-
import { ChatContext } from './ChatContext';
|
|
19
36
|
import styles from './components.module.less';
|
|
20
37
|
|
|
21
38
|
const INSTRUCTION_BOTTOM = 8;
|
|
@@ -194,13 +211,30 @@ export const ChatInput = React.forwardRef((props: IChatInputProps, ref) => {
|
|
|
194
211
|
const [showExpand, setShowExpand] = useState(false);
|
|
195
212
|
const [isExpand, setIsExpand] = useState(false);
|
|
196
213
|
const [placeholder, setPlaceHolder] = useState(localize('aiNative.chat.input.placeholder.default'));
|
|
197
|
-
|
|
214
|
+
const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
|
|
215
|
+
const dialogService = useInjectable<IDialogService>(IDialogService);
|
|
216
|
+
const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
|
|
217
|
+
const mcpServerProxyService = useInjectable<MCPServerProxyService>(TokenMCPServerProxyService);
|
|
198
218
|
const monacoCommandRegistry = useInjectable<MonacoCommandRegistry>(MonacoCommandRegistry);
|
|
199
219
|
const chatAgentService = useInjectable<IChatAgentService>(IChatAgentService);
|
|
200
220
|
const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
|
|
221
|
+
const commandService = useInjectable<CommandService>(CommandService);
|
|
201
222
|
|
|
202
223
|
const currentAgentIdRef = useLatest(agentId);
|
|
203
224
|
|
|
225
|
+
const handleShowMCPConfig = React.useCallback(() => {
|
|
226
|
+
commandService.executeCommand(OPEN_MCP_CONFIG_COMMAND.id);
|
|
227
|
+
}, [commandService]);
|
|
228
|
+
|
|
229
|
+
const handleShowMCPTools = React.useCallback(async () => {
|
|
230
|
+
const tools = await mcpServerProxyService.getAllMCPTools();
|
|
231
|
+
dialogService.open({
|
|
232
|
+
message: <MCPToolsDialog tools={tools} />,
|
|
233
|
+
type: MessageType.Empty,
|
|
234
|
+
buttons: [localize('dialog.file.close')],
|
|
235
|
+
});
|
|
236
|
+
}, [mcpServerProxyService, dialogService]);
|
|
237
|
+
|
|
204
238
|
useImperativeHandle(ref, () => ({
|
|
205
239
|
setInputValue: (v: string) => {
|
|
206
240
|
setValue(v);
|
|
@@ -297,6 +331,10 @@ export const ChatInput = React.forwardRef((props: IChatInputProps, ref) => {
|
|
|
297
331
|
}
|
|
298
332
|
}, []);
|
|
299
333
|
|
|
334
|
+
const handleStop = useCallback(() => {
|
|
335
|
+
aiChatService.cancelRequest();
|
|
336
|
+
}, []);
|
|
337
|
+
|
|
300
338
|
const handleSend = useCallback(async () => {
|
|
301
339
|
if (disabled) {
|
|
302
340
|
return;
|
|
@@ -457,11 +495,48 @@ export const ChatInput = React.forwardRef((props: IChatInputProps, ref) => {
|
|
|
457
495
|
disabled={disabled}
|
|
458
496
|
className={styles.input_wrapper}
|
|
459
497
|
onSend={handleSend}
|
|
498
|
+
onStop={handleStop}
|
|
460
499
|
sendBtnClassName={sendBtnClassName}
|
|
461
500
|
onHeightChange={handleHeightChange}
|
|
462
501
|
height={inputHeight}
|
|
463
502
|
popoverPosition={PopoverPosition.left}
|
|
464
503
|
/>
|
|
504
|
+
<div className={styles.chat_input_footer}>
|
|
505
|
+
{aiNativeConfigService.capabilities.supportsMCP && (
|
|
506
|
+
<div className={styles.mcp_desc}>
|
|
507
|
+
<Popover
|
|
508
|
+
overlayClassName={styles.popover_icon}
|
|
509
|
+
id={'ai-chat-header-mcp-server'}
|
|
510
|
+
position={PopoverPosition.left}
|
|
511
|
+
title={'MCP Server'}
|
|
512
|
+
>
|
|
513
|
+
<EnhanceIcon
|
|
514
|
+
wrapperClassName={styles.action_btn}
|
|
515
|
+
className={'codicon codicon-server'}
|
|
516
|
+
onClick={handleShowMCPConfig}
|
|
517
|
+
tabIndex={0}
|
|
518
|
+
role='button'
|
|
519
|
+
ariaLabel={'MCP Server'}
|
|
520
|
+
/>
|
|
521
|
+
</Popover>
|
|
522
|
+
<Popover
|
|
523
|
+
overlayClassName={styles.popover_icon}
|
|
524
|
+
id={'ai-chat-header-tools'}
|
|
525
|
+
position={PopoverPosition.left}
|
|
526
|
+
title={localize('aiNative.operate.tools.title')}
|
|
527
|
+
>
|
|
528
|
+
<EnhanceIcon
|
|
529
|
+
wrapperClassName={styles.action_btn}
|
|
530
|
+
className={getIcon('menubar-tool')}
|
|
531
|
+
onClick={handleShowMCPTools}
|
|
532
|
+
tabIndex={0}
|
|
533
|
+
role='button'
|
|
534
|
+
ariaLabel={localize('aiNative.operate.tools.title')}
|
|
535
|
+
/>
|
|
536
|
+
</Popover>
|
|
537
|
+
</div>
|
|
538
|
+
)}
|
|
539
|
+
</div>
|
|
465
540
|
</div>
|
|
466
541
|
);
|
|
467
542
|
});
|
|
@@ -235,7 +235,7 @@ export const ChatReply = (props: IChatReplyProps) => {
|
|
|
235
235
|
if (onDone) {
|
|
236
236
|
onDone();
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
// 模型消息返回结束,上报消息(包含toolCall等全部结束)
|
|
239
239
|
aiReporter.end(relationId, {
|
|
240
240
|
assistantMessage: request.response.responseText,
|
|
241
241
|
replytime: Date.now() - startTime,
|
|
@@ -243,6 +243,8 @@ export const ChatReply = (props: IChatReplyProps) => {
|
|
|
243
243
|
isStop: false,
|
|
244
244
|
command,
|
|
245
245
|
agentId,
|
|
246
|
+
messageId: msgId,
|
|
247
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
246
248
|
});
|
|
247
249
|
}
|
|
248
250
|
|
|
@@ -272,6 +274,8 @@ export const ChatReply = (props: IChatReplyProps) => {
|
|
|
272
274
|
isStop: true,
|
|
273
275
|
command,
|
|
274
276
|
agentId,
|
|
277
|
+
messageId: msgId,
|
|
278
|
+
sessionId: aiChatService.sessionModel.sessionId,
|
|
275
279
|
});
|
|
276
280
|
aiChatService.cancelRequest();
|
|
277
281
|
};
|
|
@@ -351,11 +355,7 @@ export const ChatReply = (props: IChatReplyProps) => {
|
|
|
351
355
|
}, [request.response.followups]);
|
|
352
356
|
|
|
353
357
|
if (!request.response.isComplete) {
|
|
354
|
-
return
|
|
355
|
-
<ChatThinking message={request.response.responseText} onStop={onStop}>
|
|
356
|
-
{contentNode}
|
|
357
|
-
</ChatThinking>
|
|
358
|
-
);
|
|
358
|
+
return <ChatThinking message={request.response.responseText}>{contentNode}</ChatThinking>;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
return (
|
|
@@ -18,14 +18,12 @@ interface ITinkingProps {
|
|
|
18
18
|
message?: string;
|
|
19
19
|
onRegenerate?: () => void;
|
|
20
20
|
requestId?: string;
|
|
21
|
-
onStop?: () => void;
|
|
22
21
|
thinkingText?: string;
|
|
23
|
-
showStop?: boolean;
|
|
24
22
|
showRegenerate?: boolean;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export const ChatThinking = (props: ITinkingProps) => {
|
|
28
|
-
const { children, message,
|
|
26
|
+
const { children, message, thinkingText } = props;
|
|
29
27
|
|
|
30
28
|
const chatRenderRegistry = useInjectable<ChatRenderRegistry>(ChatRenderRegistryToken);
|
|
31
29
|
|
|
@@ -34,10 +32,6 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
34
32
|
[chatRenderRegistry, chatRenderRegistry.chatThinkingRender],
|
|
35
33
|
);
|
|
36
34
|
|
|
37
|
-
const handlePause = useCallback(async () => {
|
|
38
|
-
onStop && onStop();
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
35
|
const renderContent = useCallback(() => {
|
|
42
36
|
if (!children || !message?.trim()) {
|
|
43
37
|
if (CustomThinkingRender) {
|
|
@@ -61,12 +55,12 @@ export const ChatThinking = (props: ITinkingProps) => {
|
|
|
61
55
|
{!children && <Progress loading={true} wrapperClassName={styles.ai_native_progress_wrapper} />}
|
|
62
56
|
</span>
|
|
63
57
|
)}
|
|
64
|
-
{showStop && (
|
|
58
|
+
{/* {showStop && (
|
|
65
59
|
<div className={styles.block} onClick={handlePause} tabIndex={0} role='button'>
|
|
66
60
|
<Icon className={getIcon('circle-pause')}></Icon>
|
|
67
61
|
<span>{localize('aiNative.operate.stop.title')}</span>
|
|
68
62
|
</div>
|
|
69
|
-
)}
|
|
63
|
+
)} */}
|
|
70
64
|
</div>
|
|
71
65
|
</div>
|
|
72
66
|
</>
|
|
@@ -67,13 +67,12 @@ export const ChatToolRender = (props: { value: IChatToolContent['content']; mess
|
|
|
67
67
|
<div className={styles['chat-tool-render']}>
|
|
68
68
|
<div className={styles['tool-header']} onClick={toggleExpand}>
|
|
69
69
|
<div className={styles['tool-name']}>
|
|
70
|
-
<
|
|
70
|
+
<Icon iconClass={`codicon codicon-triangle-${isExpanded ? 'down' : 'right'}`} />
|
|
71
71
|
{label}
|
|
72
72
|
</div>
|
|
73
73
|
{value.state && (
|
|
74
74
|
<div className={styles['tool-state']}>
|
|
75
75
|
<span className={styles['state-icon']}>{stateInfo.icon}</span>
|
|
76
|
-
<span className={styles['state-label']}>{stateInfo.label}</span>
|
|
77
76
|
</div>
|
|
78
77
|
)}
|
|
79
78
|
</div>
|
|
@@ -62,7 +62,7 @@ export const WelcomeMessage = () => {
|
|
|
62
62
|
}, []);
|
|
63
63
|
|
|
64
64
|
if (!welcomeMessage) {
|
|
65
|
-
return <ChatThinking
|
|
65
|
+
return <ChatThinking thinkingText={localize('aiNative.chat.welcome.loading.text')} />;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const allSampleQuestions = React.useMemo(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
font-size: 13px;
|
|
6
|
-
padding: 0
|
|
6
|
+
padding: 0 0 0 12px;
|
|
7
7
|
color: var(--editor-foreground);
|
|
8
8
|
text-overflow: ellipsis;
|
|
9
9
|
white-space: nowrap;
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
.dm-chat-history-list {
|
|
79
79
|
overflow: auto;
|
|
80
80
|
max-height: 400px;
|
|
81
|
+
max-width: 400px;
|
|
81
82
|
margin-top: 4px;
|
|
82
83
|
font-size: 13px;
|
|
83
84
|
}
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
.chat_input_container {
|
|
97
97
|
position: relative;
|
|
98
98
|
border-radius: 9px;
|
|
99
|
+
padding: 10px 0px 0px 0px;
|
|
99
100
|
border: 1px solid var(--kt-input-border);
|
|
100
101
|
background-color: var(--design-chatInput-background);
|
|
101
102
|
&.active {
|
|
@@ -283,6 +284,8 @@
|
|
|
283
284
|
position: relative;
|
|
284
285
|
min-width: 100px;
|
|
285
286
|
margin-top: 4px;
|
|
287
|
+
max-height: 300px;
|
|
288
|
+
overflow: auto;
|
|
286
289
|
|
|
287
290
|
:global {
|
|
288
291
|
.hljs {
|
|
@@ -505,3 +508,22 @@
|
|
|
505
508
|
}
|
|
506
509
|
}
|
|
507
510
|
}
|
|
511
|
+
|
|
512
|
+
.chat_input_footer {
|
|
513
|
+
padding: 0px 10px;
|
|
514
|
+
display: flex;
|
|
515
|
+
align-items: center;
|
|
516
|
+
font-size: 12px;
|
|
517
|
+
|
|
518
|
+
.model_selector {
|
|
519
|
+
display: flex;
|
|
520
|
+
font-size: 11px;
|
|
521
|
+
align-items: center;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.mcp_desc {
|
|
525
|
+
padding: 5px 0px;
|
|
526
|
+
display: flex;
|
|
527
|
+
align-items: center;
|
|
528
|
+
}
|
|
529
|
+
}
|