@vectorx/agent-simulator 1.0.0 → 1.1.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/app.d.ts +1 -1
- package/lib/app.js +4 -4
- package/lib/config/api.config.d.ts +0 -1
- package/lib/config/api.config.js +3 -2
- package/lib/config/app.config.d.ts +2 -1
- package/lib/config/app.config.js +0 -1
- package/lib/config/upload.config.d.ts +0 -1
- package/lib/config/upload.config.js +0 -1
- package/lib/container/container.d.ts +0 -1
- package/lib/container/container.js +4 -2
- package/lib/container/identifiers.d.ts +0 -1
- package/lib/container/identifiers.js +0 -1
- package/lib/container/index.d.ts +0 -1
- package/lib/container/index.js +0 -1
- package/lib/container/types.d.ts +9 -1
- package/lib/container/types.js +0 -1
- package/lib/controllers/agent.controller.d.ts +6 -3
- package/lib/controllers/agent.controller.js +17 -3
- package/lib/controllers/auth.controller.d.ts +4 -5
- package/lib/controllers/auth.controller.js +3 -4
- package/lib/controllers/simulator.controller.d.ts +2 -3
- package/lib/controllers/simulator.controller.js +1 -2
- package/lib/controllers/upload.controller.d.ts +1 -2
- package/lib/controllers/upload.controller.js +5 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.js +0 -1
- package/lib/middleware/cors.middleware.d.ts +0 -1
- package/lib/middleware/cors.middleware.js +0 -1
- package/lib/middleware/error.middleware.d.ts +3 -4
- package/lib/middleware/error.middleware.js +2 -3
- package/lib/middleware/proxy.middleware.d.ts +1 -2
- package/lib/middleware/proxy.middleware.js +0 -1
- package/lib/middleware/upload.middleware.d.ts +0 -1
- package/lib/middleware/upload.middleware.js +0 -1
- package/lib/routes/agent.d.ts +0 -1
- package/lib/routes/agent.js +2 -1
- package/lib/routes/auth.d.ts +0 -1
- package/lib/routes/auth.js +0 -1
- package/lib/routes/index.d.ts +0 -1
- package/lib/routes/index.js +0 -1
- package/lib/routes/simulator.d.ts +0 -1
- package/lib/routes/simulator.js +0 -1
- package/lib/routes/upload.d.ts +0 -1
- package/lib/routes/upload.js +0 -1
- package/lib/services/agent.service.d.ts +15 -2
- package/lib/services/agent.service.js +34 -8
- package/lib/services/auth.service.d.ts +1 -2
- package/lib/services/auth.service.js +5 -6
- package/lib/services/simulator.service.d.ts +0 -1
- package/lib/services/simulator.service.js +0 -1
- package/lib/services/upload.service.d.ts +0 -1
- package/lib/services/upload.service.js +0 -1
- package/lib/simulator.d.ts +11 -1
- package/lib/simulator.js +90 -6
- package/lib/utils/env-helper.d.ts +0 -1
- package/lib/utils/env-helper.js +0 -1
- package/lib/utils/logger.d.ts +0 -1
- package/lib/utils/logger.js +0 -1
- package/lib/utils/request.d.ts +0 -1
- package/lib/utils/request.js +6 -2
- package/lib/utils/url-parser.d.ts +0 -1
- package/lib/utils/url-parser.js +1 -2
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +0 -1
- package/lib/webview-ui/Agent.d.ts +0 -1
- package/lib/webview-ui/Agent.js +0 -1
- package/lib/webview-ui/App.d.ts +0 -1
- package/lib/webview-ui/App.js +176 -34
- package/lib/webview-ui/ErrorBoundary.d.ts +0 -1
- package/lib/webview-ui/ErrorBoundary.js +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts +1 -2
- package/lib/webview-ui/components/AsyncTaskBlock.js +16 -5
- package/lib/webview-ui/components/AuthIndicator.d.ts +1 -2
- package/lib/webview-ui/components/AuthIndicator.js +0 -1
- package/lib/webview-ui/components/ErrorCard.d.ts +1 -2
- package/lib/webview-ui/components/ErrorCard.js +7 -5
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +1 -2
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +4 -3
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts +1 -2
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +1 -2
- package/lib/webview-ui/components/MarkdownRenderer.d.ts +1 -2
- package/lib/webview-ui/components/MarkdownRenderer.js +3 -8
- package/lib/webview-ui/components/MessageRenderer.d.ts +1 -2
- package/lib/webview-ui/components/MessageRenderer.js +48 -5
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts +2 -2
- package/lib/webview-ui/components/MultimodalFileRenderer.js +97 -40
- package/lib/webview-ui/components/ThinkingBlock.d.ts +2 -3
- package/lib/webview-ui/components/ThinkingBlock.js +0 -1
- package/lib/webview-ui/components/ToolUseBlock.d.ts +1 -2
- package/lib/webview-ui/components/ToolUseBlock.js +1 -2
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts +1 -2
- package/lib/webview-ui/components/ToolUseBlockHeader.js +1 -2
- package/lib/webview-ui/components/UploadPreview.d.ts +1 -2
- package/lib/webview-ui/components/UploadPreview.js +0 -1
- package/lib/webview-ui/components/WelcomeModule.d.ts +0 -1
- package/lib/webview-ui/components/WelcomeModule.js +46 -16
- package/lib/webview-ui/components/index.d.ts +0 -1
- package/lib/webview-ui/components/index.js +0 -1
- package/lib/webview-ui/config/cos-config.d.ts +0 -1
- package/lib/webview-ui/config/cos-config.js +0 -1
- package/lib/webview-ui/config/http-config.d.ts +0 -1
- package/lib/webview-ui/config/http-config.js +0 -1
- package/lib/webview-ui/constants.d.ts +0 -1
- package/lib/webview-ui/constants.js +0 -1
- package/lib/webview-ui/contexts/AgentContext.d.ts +1 -2
- package/lib/webview-ui/contexts/AgentContext.js +0 -1
- package/lib/webview-ui/contexts/AuthContext.d.ts +2 -2
- package/lib/webview-ui/contexts/AuthContext.js +0 -1
- package/lib/webview-ui/contexts/ThemeContext.d.ts +2 -2
- package/lib/webview-ui/contexts/ThemeContext.js +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.d.ts +4 -2
- package/lib/webview-ui/hooks/useAgentStatus.js +31 -5
- package/lib/webview-ui/hooks/useUploader.d.ts +0 -1
- package/lib/webview-ui/hooks/useUploader.js +5 -2
- package/lib/webview-ui/hooks/useUserAvatar.d.ts +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.js +0 -1
- package/lib/webview-ui/index.d.ts +1 -1
- package/lib/webview-ui/index.js +1 -1
- package/lib/webview-ui/services/agent-service.d.ts +14 -1
- package/lib/webview-ui/services/agent-service.js +7 -1
- package/lib/webview-ui/services/index.d.ts +0 -1
- package/lib/webview-ui/services/index.js +0 -1
- package/lib/webview-ui/services/logger-service.d.ts +0 -1
- package/lib/webview-ui/services/logger-service.js +0 -1
- package/lib/webview-ui/styles/copilot.d.ts +0 -1
- package/lib/webview-ui/styles/copilot.js +80 -22
- package/lib/webview-ui/styles/workarea.d.ts +0 -1
- package/lib/webview-ui/styles/workarea.js +7 -2
- package/lib/webview-ui/types.d.ts +11 -2
- package/lib/webview-ui/types.js +0 -1
- package/lib/webview-ui/utils/cos.d.ts +0 -1
- package/lib/webview-ui/utils/cos.js +4 -3
- package/lib/webview-ui/utils/env-helper.d.ts +6 -1
- package/lib/webview-ui/utils/env-helper.js +16 -2
- package/lib/webview-ui/utils/http-client.d.ts +1 -2
- package/lib/webview-ui/utils/http-client.js +0 -1
- package/lib/webview-ui/utils/markdownHighlight.d.ts +3 -0
- package/lib/webview-ui/utils/markdownHighlight.js +75 -0
- package/lib/webview-ui/utils/stream-text-handler.d.ts +0 -1
- package/lib/webview-ui/utils/stream-text-handler.js +6 -3
- package/lib/webview-ui/utils/upload.d.ts +0 -1
- package/lib/webview-ui/utils/upload.js +5 -2
- package/lib/webview-ui/widgets/BubbleComponents.d.ts +1 -2
- package/lib/webview-ui/widgets/BubbleComponents.js +1 -2
- package/lib/webview-ui/widgets/ChatInput.d.ts +1 -2
- package/lib/webview-ui/widgets/ChatInput.js +63 -90
- package/lib/webview-ui/widgets/LogPanel.d.ts +2 -3
- package/lib/webview-ui/widgets/LogPanel.js +5 -2
- package/lib/webview-ui/widgets/SystemLogs.d.ts +1 -2
- package/lib/webview-ui/widgets/SystemLogs.js +26 -9
- package/lib/webview-ui/widgets/ToolBar.d.ts +4 -3
- package/lib/webview-ui/widgets/ToolBar.js +6 -4
- package/lib/webview-ui/widgets/WebSocketDebugger.d.ts +6 -0
- package/lib/webview-ui/widgets/WebSocketDebugger.js +226 -0
- package/lib/webview-ui/widgets/index.d.ts +0 -1
- package/lib/webview-ui/widgets/index.js +0 -1
- package/package.json +9 -7
- package/public/assets/main.js +193 -166
- package/public/assets/style.css +1 -1
- package/lib/app.d.ts.map +0 -1
- package/lib/app.js.map +0 -1
- package/lib/config/api.config.d.ts.map +0 -1
- package/lib/config/api.config.js.map +0 -1
- package/lib/config/app.config.d.ts.map +0 -1
- package/lib/config/app.config.js.map +0 -1
- package/lib/config/upload.config.d.ts.map +0 -1
- package/lib/config/upload.config.js.map +0 -1
- package/lib/container/container.d.ts.map +0 -1
- package/lib/container/container.js.map +0 -1
- package/lib/container/identifiers.d.ts.map +0 -1
- package/lib/container/identifiers.js.map +0 -1
- package/lib/container/index.d.ts.map +0 -1
- package/lib/container/index.js.map +0 -1
- package/lib/container/types.d.ts.map +0 -1
- package/lib/container/types.js.map +0 -1
- package/lib/controllers/agent.controller.d.ts.map +0 -1
- package/lib/controllers/agent.controller.js.map +0 -1
- package/lib/controllers/auth.controller.d.ts.map +0 -1
- package/lib/controllers/auth.controller.js.map +0 -1
- package/lib/controllers/simulator.controller.d.ts.map +0 -1
- package/lib/controllers/simulator.controller.js.map +0 -1
- package/lib/controllers/upload.controller.d.ts.map +0 -1
- package/lib/controllers/upload.controller.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/middleware/cors.middleware.d.ts.map +0 -1
- package/lib/middleware/cors.middleware.js.map +0 -1
- package/lib/middleware/error.middleware.d.ts.map +0 -1
- package/lib/middleware/error.middleware.js.map +0 -1
- package/lib/middleware/proxy.middleware.d.ts.map +0 -1
- package/lib/middleware/proxy.middleware.js.map +0 -1
- package/lib/middleware/upload.middleware.d.ts.map +0 -1
- package/lib/middleware/upload.middleware.js.map +0 -1
- package/lib/routes/agent.d.ts.map +0 -1
- package/lib/routes/agent.js.map +0 -1
- package/lib/routes/auth.d.ts.map +0 -1
- package/lib/routes/auth.js.map +0 -1
- package/lib/routes/index.d.ts.map +0 -1
- package/lib/routes/index.js.map +0 -1
- package/lib/routes/simulator.d.ts.map +0 -1
- package/lib/routes/simulator.js.map +0 -1
- package/lib/routes/upload.d.ts.map +0 -1
- package/lib/routes/upload.js.map +0 -1
- package/lib/services/agent.service.d.ts.map +0 -1
- package/lib/services/agent.service.js.map +0 -1
- package/lib/services/auth.service.d.ts.map +0 -1
- package/lib/services/auth.service.js.map +0 -1
- package/lib/services/simulator.service.d.ts.map +0 -1
- package/lib/services/simulator.service.js.map +0 -1
- package/lib/services/upload.service.d.ts.map +0 -1
- package/lib/services/upload.service.js.map +0 -1
- package/lib/simulator.d.ts.map +0 -1
- package/lib/simulator.js.map +0 -1
- package/lib/utils/env-helper.d.ts.map +0 -1
- package/lib/utils/env-helper.js.map +0 -1
- package/lib/utils/logger.d.ts.map +0 -1
- package/lib/utils/logger.js.map +0 -1
- package/lib/utils/request.d.ts.map +0 -1
- package/lib/utils/request.js.map +0 -1
- package/lib/utils/url-parser.d.ts.map +0 -1
- package/lib/utils/url-parser.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/lib/webview-ui/Agent.d.ts.map +0 -1
- package/lib/webview-ui/Agent.js.map +0 -1
- package/lib/webview-ui/App.d.ts.map +0 -1
- package/lib/webview-ui/App.js.map +0 -1
- package/lib/webview-ui/ErrorBoundary.d.ts.map +0 -1
- package/lib/webview-ui/ErrorBoundary.js.map +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.js.map +0 -1
- package/lib/webview-ui/components/AuthIndicator.d.ts.map +0 -1
- package/lib/webview-ui/components/AuthIndicator.js.map +0 -1
- package/lib/webview-ui/components/ErrorCard.d.ts.map +0 -1
- package/lib/webview-ui/components/ErrorCard.js.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js.map +0 -1
- package/lib/webview-ui/components/MarkdownRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MarkdownRenderer.js.map +0 -1
- package/lib/webview-ui/components/MessageRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MessageRenderer.js.map +0 -1
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MultimodalFileRenderer.js.map +0 -1
- package/lib/webview-ui/components/ThinkingBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/ThinkingBlock.js.map +0 -1
- package/lib/webview-ui/components/ToolUseBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/ToolUseBlock.js.map +0 -1
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts.map +0 -1
- package/lib/webview-ui/components/ToolUseBlockHeader.js.map +0 -1
- package/lib/webview-ui/components/UploadPreview.d.ts.map +0 -1
- package/lib/webview-ui/components/UploadPreview.js.map +0 -1
- package/lib/webview-ui/components/WelcomeModule.d.ts.map +0 -1
- package/lib/webview-ui/components/WelcomeModule.js.map +0 -1
- package/lib/webview-ui/components/index.d.ts.map +0 -1
- package/lib/webview-ui/components/index.js.map +0 -1
- package/lib/webview-ui/config/cos-config.d.ts.map +0 -1
- package/lib/webview-ui/config/cos-config.js.map +0 -1
- package/lib/webview-ui/config/http-config.d.ts.map +0 -1
- package/lib/webview-ui/config/http-config.js.map +0 -1
- package/lib/webview-ui/constants.d.ts.map +0 -1
- package/lib/webview-ui/constants.js.map +0 -1
- package/lib/webview-ui/contexts/AgentContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/AgentContext.js.map +0 -1
- package/lib/webview-ui/contexts/AuthContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/AuthContext.js.map +0 -1
- package/lib/webview-ui/contexts/ThemeContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/ThemeContext.js.map +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.js.map +0 -1
- package/lib/webview-ui/hooks/useUploader.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useUploader.js.map +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.js.map +0 -1
- package/lib/webview-ui/index.d.ts.map +0 -1
- package/lib/webview-ui/index.js.map +0 -1
- package/lib/webview-ui/services/agent-service.d.ts.map +0 -1
- package/lib/webview-ui/services/agent-service.js.map +0 -1
- package/lib/webview-ui/services/index.d.ts.map +0 -1
- package/lib/webview-ui/services/index.js.map +0 -1
- package/lib/webview-ui/services/logger-service.d.ts.map +0 -1
- package/lib/webview-ui/services/logger-service.js.map +0 -1
- package/lib/webview-ui/styles/copilot.d.ts.map +0 -1
- package/lib/webview-ui/styles/copilot.js.map +0 -1
- package/lib/webview-ui/styles/workarea.d.ts.map +0 -1
- package/lib/webview-ui/styles/workarea.js.map +0 -1
- package/lib/webview-ui/types.d.ts.map +0 -1
- package/lib/webview-ui/types.js.map +0 -1
- package/lib/webview-ui/utils/cos.d.ts.map +0 -1
- package/lib/webview-ui/utils/cos.js.map +0 -1
- package/lib/webview-ui/utils/env-helper.d.ts.map +0 -1
- package/lib/webview-ui/utils/env-helper.js.map +0 -1
- package/lib/webview-ui/utils/http-client.d.ts.map +0 -1
- package/lib/webview-ui/utils/http-client.js.map +0 -1
- package/lib/webview-ui/utils/stream-text-handler.d.ts.map +0 -1
- package/lib/webview-ui/utils/stream-text-handler.js.map +0 -1
- package/lib/webview-ui/utils/upload.d.ts.map +0 -1
- package/lib/webview-ui/utils/upload.js.map +0 -1
- package/lib/webview-ui/widgets/BubbleComponents.d.ts.map +0 -1
- package/lib/webview-ui/widgets/BubbleComponents.js.map +0 -1
- package/lib/webview-ui/widgets/ChatInput.d.ts.map +0 -1
- package/lib/webview-ui/widgets/ChatInput.js.map +0 -1
- package/lib/webview-ui/widgets/LogPanel.d.ts.map +0 -1
- package/lib/webview-ui/widgets/LogPanel.js.map +0 -1
- package/lib/webview-ui/widgets/SystemLogs.d.ts.map +0 -1
- package/lib/webview-ui/widgets/SystemLogs.js.map +0 -1
- package/lib/webview-ui/widgets/ToolBar.d.ts.map +0 -1
- package/lib/webview-ui/widgets/ToolBar.js.map +0 -1
- package/lib/webview-ui/widgets/index.d.ts.map +0 -1
- package/lib/webview-ui/widgets/index.js.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mdWithHighlight = void 0;
|
|
7
|
+
const core_1 = __importDefault(require("highlight.js/lib/core"));
|
|
8
|
+
const bash_1 = __importDefault(require("highlight.js/lib/languages/bash"));
|
|
9
|
+
const css_1 = __importDefault(require("highlight.js/lib/languages/css"));
|
|
10
|
+
const javascript_1 = __importDefault(require("highlight.js/lib/languages/javascript"));
|
|
11
|
+
const json_1 = __importDefault(require("highlight.js/lib/languages/json"));
|
|
12
|
+
const python_1 = __importDefault(require("highlight.js/lib/languages/python"));
|
|
13
|
+
const typescript_1 = __importDefault(require("highlight.js/lib/languages/typescript"));
|
|
14
|
+
const xml_1 = __importDefault(require("highlight.js/lib/languages/xml"));
|
|
15
|
+
const markdown_it_1 = __importDefault(require("markdown-it"));
|
|
16
|
+
// 只注册常用语言,控制体积
|
|
17
|
+
core_1.default.registerLanguage("javascript", javascript_1.default);
|
|
18
|
+
core_1.default.registerLanguage("typescript", typescript_1.default);
|
|
19
|
+
core_1.default.registerLanguage("json", json_1.default);
|
|
20
|
+
core_1.default.registerLanguage("python", python_1.default);
|
|
21
|
+
core_1.default.registerLanguage("bash", bash_1.default);
|
|
22
|
+
core_1.default.registerLanguage("shell", bash_1.default);
|
|
23
|
+
core_1.default.registerLanguage("sh", bash_1.default);
|
|
24
|
+
core_1.default.registerLanguage("css", css_1.default);
|
|
25
|
+
core_1.default.registerLanguage("html", xml_1.default);
|
|
26
|
+
core_1.default.registerLanguage("xml", xml_1.default);
|
|
27
|
+
function escapeHtml(str) {
|
|
28
|
+
return str
|
|
29
|
+
.replace(/&/g, "&")
|
|
30
|
+
.replace(/</g, "<")
|
|
31
|
+
.replace(/>/g, ">")
|
|
32
|
+
.replace(/"/g, """);
|
|
33
|
+
}
|
|
34
|
+
/** 带代码高亮的 markdown-it 实例,供 MarkdownRenderer 等使用 */
|
|
35
|
+
exports.mdWithHighlight = new markdown_it_1.default({
|
|
36
|
+
html: true,
|
|
37
|
+
breaks: true,
|
|
38
|
+
highlight(str, lang) {
|
|
39
|
+
if (lang && core_1.default.getLanguage(lang)) {
|
|
40
|
+
try {
|
|
41
|
+
const { value } = core_1.default.highlight(str, {
|
|
42
|
+
language: lang,
|
|
43
|
+
ignoreIllegals: true,
|
|
44
|
+
});
|
|
45
|
+
return `<pre class="hljs"><code class="hljs">${value}</code></pre>`;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// fallback to escaped
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return `<pre class="hljs"><code class="hljs">${escapeHtml(str)}</code></pre>`;
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
// 统一处理 markdown 内的链接:在新窗口/标签页中打开,避免在当前 webview/iframe 中跳转导致被 CSP 限制
|
|
55
|
+
exports.mdWithHighlight.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
|
56
|
+
const token = tokens[idx];
|
|
57
|
+
// target="_blank"
|
|
58
|
+
const targetIndex = token.attrIndex("target");
|
|
59
|
+
if (targetIndex < 0) {
|
|
60
|
+
token.attrPush(["target", "_blank"]);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
token.attrs[targetIndex][1] = "_blank";
|
|
64
|
+
}
|
|
65
|
+
// rel="noopener noreferrer"
|
|
66
|
+
const relIndex = token.attrIndex("rel");
|
|
67
|
+
const relValue = "noopener noreferrer";
|
|
68
|
+
if (relIndex < 0) {
|
|
69
|
+
token.attrPush(["rel", relValue]);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
token.attrs[relIndex][1] = relValue;
|
|
73
|
+
}
|
|
74
|
+
return self.renderToken(tokens, idx, options);
|
|
75
|
+
};
|
|
@@ -18,7 +18,7 @@ function parseStreamChunk(dataLine) {
|
|
|
18
18
|
}
|
|
19
19
|
if (obj && Array.isArray(obj.choices))
|
|
20
20
|
return obj;
|
|
21
|
-
if (obj
|
|
21
|
+
if (obj?.data && Array.isArray(obj.data.choices))
|
|
22
22
|
return obj.data;
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
@@ -45,10 +45,13 @@ function parseNonStreamChunk(chunk) {
|
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
47
|
const inner = chunk.data;
|
|
48
|
-
if (inner &&
|
|
48
|
+
if (inner &&
|
|
49
|
+
typeof inner === "object" &&
|
|
50
|
+
typeof inner.code === "number" &&
|
|
51
|
+
inner.code === 0 &&
|
|
52
|
+
inner.data) {
|
|
49
53
|
if (Array.isArray(inner.data.choices))
|
|
50
54
|
return inner.data;
|
|
51
55
|
}
|
|
52
56
|
return null;
|
|
53
57
|
}
|
|
54
|
-
//# sourceMappingURL=stream-text-handler.js.map
|
|
@@ -17,6 +17,9 @@ async function getUploadToken() {
|
|
|
17
17
|
}
|
|
18
18
|
function createUploader(options) {
|
|
19
19
|
const { bizName, scene, getToken } = options;
|
|
20
|
-
return new cos_1.Uploader({
|
|
20
|
+
return new cos_1.Uploader({
|
|
21
|
+
bizName,
|
|
22
|
+
scene,
|
|
23
|
+
getToken: getToken ?? getUploadToken,
|
|
24
|
+
});
|
|
21
25
|
}
|
|
22
|
-
//# sourceMappingURL=upload.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type React from "react";
|
|
2
2
|
export declare const ReasoningCard: React.FC<{
|
|
3
3
|
content: string;
|
|
4
4
|
}>;
|
|
5
5
|
export declare const CustomMarkdown: React.FC<{
|
|
6
6
|
content: string | any;
|
|
7
7
|
}>;
|
|
8
|
-
//# sourceMappingURL=BubbleComponents.d.ts.map
|
|
@@ -43,7 +43,7 @@ const CustomMarkdown = ({ content }) => {
|
|
|
43
43
|
try {
|
|
44
44
|
return JSON.stringify(content);
|
|
45
45
|
}
|
|
46
|
-
catch (
|
|
46
|
+
catch (_e) {
|
|
47
47
|
return String(content);
|
|
48
48
|
}
|
|
49
49
|
})();
|
|
@@ -59,4 +59,3 @@ const CustomMarkdown = ({ content }) => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
exports.CustomMarkdown = CustomMarkdown;
|
|
62
|
-
//# sourceMappingURL=BubbleComponents.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type React from "react";
|
|
2
2
|
import "./ChatInput.less";
|
|
3
3
|
interface ChatInputProps {
|
|
4
4
|
loading: boolean;
|
|
@@ -24,4 +24,3 @@ interface ChatInputProps {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const ChatInput: React.FC<ChatInputProps>;
|
|
26
26
|
export {};
|
|
27
|
-
//# sourceMappingURL=ChatInput.d.ts.map
|
|
@@ -10,53 +10,10 @@ const ThemeContext_1 = require("../contexts/ThemeContext");
|
|
|
10
10
|
const agent_service_1 = require("../services/agent-service");
|
|
11
11
|
const env_helper_1 = require("../utils/env-helper");
|
|
12
12
|
require("./ChatInput.less");
|
|
13
|
-
const
|
|
14
|
-
{ label: "帮我写一篇关于AI的文章", value: "ai-article" },
|
|
15
|
-
{ label: "生成一张夕阳下的海滩图片", value: "beach-image" },
|
|
16
|
-
{ label: "制作一个产品展示动画", value: "product-animation" },
|
|
17
|
-
{ label: "协调多个AI完成项目规划", value: "ai-planning" },
|
|
18
|
-
];
|
|
19
|
-
// 根据模块动态生成建议提示
|
|
20
|
-
const getModuleSuggestions = (moduleId) => {
|
|
21
|
-
switch (moduleId) {
|
|
22
|
-
case "chat":
|
|
23
|
-
return [
|
|
24
|
-
{ label: "帮我写一篇关于AI的文章", value: "ai-article" },
|
|
25
|
-
{ label: "帮我写一篇关于广州的旅游攻略", value: "travel-guide" },
|
|
26
|
-
{ label: "帮我写一篇购物笔记", value: "shopping-note" },
|
|
27
|
-
{ label: "帮我总结一下今天的会议内容", value: "meeting-summary" },
|
|
28
|
-
];
|
|
29
|
-
case "image":
|
|
30
|
-
return [
|
|
31
|
-
{ label: "给我一个五彩斑斓的黑", value: "colorful-black" },
|
|
32
|
-
{ label: "生成一张夕阳下的海滩图片", value: "sunset-beach" },
|
|
33
|
-
{ label: "画一只可爱的小猫咪", value: "cute-kitten" },
|
|
34
|
-
{ label: "创作一幅抽象艺术作品", value: "abstract-art" },
|
|
35
|
-
];
|
|
36
|
-
case "video":
|
|
37
|
-
// 文生视频模块暂不支持,返回默认建议
|
|
38
|
-
return [
|
|
39
|
-
{ label: "帮我写一篇关于AI的文章", value: "ai-article" },
|
|
40
|
-
{ label: "生成一张夕阳下的海滩图片", value: "beach-image" },
|
|
41
|
-
{ label: "制作一个产品展示动画", value: "product-animation" },
|
|
42
|
-
{ label: "协调多个AI完成项目规划", value: "ai-planning" },
|
|
43
|
-
];
|
|
44
|
-
case "multi-agent":
|
|
45
|
-
// 多智能体编排模块暂不支持,返回默认建议
|
|
46
|
-
return [
|
|
47
|
-
{ label: "帮我写一篇关于AI的文章", value: "ai-article" },
|
|
48
|
-
{ label: "生成一张夕阳下的海滩图片", value: "beach-image" },
|
|
49
|
-
{ label: "制作一个产品展示动画", value: "product-animation" },
|
|
50
|
-
{ label: "协调多个AI完成项目规划", value: "ai-planning" },
|
|
51
|
-
];
|
|
52
|
-
default:
|
|
53
|
-
// 默认建议(未选择模块时)
|
|
54
|
-
return MOCK_SUGGESTIONS;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const ChatInput = ({ loading, inputValue, canSendMessage, isLoggedIn, attachedFiles, uploadConfig, currentModule, attachmentsOpen = false, onAttachmentsOpenChange, onInputChange, onSubmit, onCancel, onPasteFile, enqueueUpload, onRemoveFile, getDisabledReason, onAgentFileUpload, }) => {
|
|
13
|
+
const ChatInput = ({ loading, inputValue, canSendMessage, isLoggedIn, attachedFiles, uploadConfig, currentModule: _, attachmentsOpen = false, onAttachmentsOpenChange, onInputChange, onSubmit, onCancel, onPasteFile, enqueueUpload, onRemoveFile, getDisabledReason, onAgentFileUpload, }) => {
|
|
58
14
|
// 获取主题状态
|
|
59
15
|
const { isDark } = (0, ThemeContext_1.useThemeHook)();
|
|
16
|
+
const embedded = (0, env_helper_1.isEmbeddedInIde)();
|
|
60
17
|
// 如果没有外部传入的状态控制,则使用内部状态(向后兼容)
|
|
61
18
|
const [internalAttachmentsOpen, setInternalAttachmentsOpen] = (0, react_1.useState)(false);
|
|
62
19
|
const attachmentsOpenState = attachmentsOpen !== undefined ? attachmentsOpen : internalAttachmentsOpen;
|
|
@@ -65,8 +22,6 @@ const ChatInput = ({ loading, inputValue, canSendMessage, isLoggedIn, attachedFi
|
|
|
65
22
|
const fileInputRef = (0, react_1.useRef)(null);
|
|
66
23
|
// 判断是否有上传成功的 OpenAI 文件(从 attachedFiles 中查找)
|
|
67
24
|
const hasAgentFiles = attachedFiles?.some((f) => f.fileSource === "openai" && f.status === "done") || false;
|
|
68
|
-
// 根据当前模块动态获取建议提示
|
|
69
|
-
const moduleSuggestions = getModuleSuggestions(currentModule);
|
|
70
25
|
// 处理文件上传到 Agent
|
|
71
26
|
const handleAgentFileUpload = async () => {
|
|
72
27
|
// IDE 环境下跳过登录检查
|
|
@@ -151,7 +106,13 @@ const ChatInput = ({ loading, inputValue, canSendMessage, isLoggedIn, attachedFi
|
|
|
151
106
|
return {
|
|
152
107
|
...file,
|
|
153
108
|
name: fileName,
|
|
154
|
-
description: ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
109
|
+
description: ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
gap: 6,
|
|
113
|
+
fontSize: "12px",
|
|
114
|
+
color: "#666",
|
|
115
|
+
}, children: [(0, jsx_runtime_1.jsx)(icons_1.OpenAIOutlined, { style: { fontSize: "14px", color: "#10a37f" } }), (0, jsx_runtime_1.jsxs)("span", { children: ["File ID: ", fileId] })] })),
|
|
155
116
|
// 尝试通过 thumbUrl 设置图标(如果 Attachments 支持)
|
|
156
117
|
thumbUrl: undefined, // OpenAI 文件没有图片预览
|
|
157
118
|
};
|
|
@@ -164,47 +125,59 @@ const ChatInput = ({ loading, inputValue, canSendMessage, isLoggedIn, attachedFi
|
|
|
164
125
|
title: "上传多模态文件",
|
|
165
126
|
description: "支持图片、PDF、视频、音频等文件格式",
|
|
166
127
|
} }) }));
|
|
167
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `chat-input-container ${isDark ? "dark" : ""}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
128
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `chat-input-container ${isDark ? "dark" : ""} ${embedded ? "embedded" : ""}`, style: embedded
|
|
129
|
+
? {
|
|
130
|
+
padding: "4px 8px",
|
|
131
|
+
background: "transparent",
|
|
132
|
+
borderTop: "none",
|
|
133
|
+
}
|
|
134
|
+
: undefined, children: [(0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", style: { display: "none" }, onChange: handleFileChange, accept: "*/*" }), (0, jsx_runtime_1.jsx)(x_1.Sender, { loading: loading, value: inputValue, disabled: !canSendMessage, submitType: "enter", onChange: (v) => {
|
|
135
|
+
onInputChange(v || "");
|
|
136
|
+
}, onSubmit: () => {
|
|
137
|
+
onSubmit(inputValue);
|
|
138
|
+
onInputChange("");
|
|
139
|
+
}, onCancel: onCancel, allowSpeech: true, placeholder: !canSendMessage ? getDisabledReason() || "输入消息,回车发送" : "输入消息,回车发送", style: embedded ? { fontSize: 13 } : undefined, header: sendHeader, prefix: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", className: "attachment-button", icon: (0, jsx_runtime_1.jsx)(icons_1.PaperClipOutlined, {}), size: embedded ? "small" : "middle", onClick: () => {
|
|
140
|
+
if (!(0, env_helper_1.isIDE)() && !isLoggedIn) {
|
|
141
|
+
antd_1.message.warning("请先登录后再上传文件");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
setAttachmentsOpen(!attachmentsOpenState);
|
|
145
|
+
}, disabled: !canSendMessage }), (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: { fontWeight: "bold", marginBottom: 6 }, children: "\u667A\u80FD\u4F53\u6587\u4EF6\u4E0A\u4F20 (OpenAI \u6807\u51C6)" }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
146
|
+
fontSize: "12px",
|
|
147
|
+
lineHeight: "1.6",
|
|
148
|
+
color: "rgba(255,255,255,0.85)",
|
|
149
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { children: "\u2022 \u5BF9\u63A5\u300C\u667A\u80FD\u4F53\u4E0A\u4F20\u63A5\u53E3\u670D\u52A1\u300D" }), (0, jsx_runtime_1.jsx)("div", { children: "\u2022 \u4E0A\u4F20\u6210\u529F\u540E\u8FD4\u56DE file_id" }), (0, jsx_runtime_1.jsx)("div", { children: "\u2022 \u9700\u5728\u667A\u80FD\u4F53\u5185\u81EA\u884C\u89E3\u6790\u6587\u4EF6" }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
150
|
+
marginTop: 6,
|
|
151
|
+
paddingTop: 6,
|
|
152
|
+
borderTop: "1px solid rgba(255,255,255,0.15)",
|
|
153
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
154
|
+
color: "rgba(255,255,255,0.65)",
|
|
155
|
+
marginBottom: 2,
|
|
156
|
+
}, children: (0, jsx_runtime_1.jsx)("strong", { children: "\u4E0E\u5DE6\u4FA7\u4E0A\u4F20\u7684\u533A\u522B\uFF1A" }) }), (0, jsx_runtime_1.jsx)("div", { children: "\u5DE6\u4FA7\u4E0A\u4F20\u8FD4\u56DE\u516C\u7F51\u94FE\u63A5\uFF0C\u6587\u4EF6\u76F4\u63A5\u663E\u793A\u5728\u5BF9\u8BDD\u4E2D" })] })] })] }), placement: "topLeft", overlayStyle: { maxWidth: 340 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
157
|
+
position: "relative",
|
|
158
|
+
display: "inline-block",
|
|
159
|
+
}, children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", className: "file-upload-button", size: embedded ? "small" : "middle", style: {
|
|
160
|
+
color: hasAgentFiles ? "#52c41a" : undefined,
|
|
161
|
+
transition: "color 0.3s ease",
|
|
162
|
+
}, icon: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", className: "icon size-5", width: "1em", height: "1em", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19 16v3m0 0v3m0-3h3m-3 0h-3m4-10v-.172a2 2 0 0 0-.586-1.414l-3.828-3.828A2 2 0 0 0 14.172 3H14m6 6h-4a2 2 0 0 1-2-2V3m6 6v3m-6-9H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6" }) }), onClick: handleAgentFileUpload, disabled: !canSendMessage || uploading, loading: uploading }), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
163
|
+
position: "absolute",
|
|
164
|
+
top: "2px",
|
|
165
|
+
right: "2px",
|
|
166
|
+
fontSize: "10px",
|
|
167
|
+
fontWeight: "bold",
|
|
168
|
+
color: "#1890ff",
|
|
169
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
170
|
+
borderRadius: "50%",
|
|
171
|
+
width: "14px",
|
|
172
|
+
height: "14px",
|
|
173
|
+
display: "flex",
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
justifyContent: "center",
|
|
176
|
+
lineHeight: "1",
|
|
177
|
+
pointerEvents: "none",
|
|
178
|
+
}, children: "?" })] }) })] }), onPasteFile: onPasteFile, actions: (_, info) => {
|
|
179
|
+
const { SendButton, LoadingButton, SpeechButton } = info.components;
|
|
180
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "action-buttons", children: [(0, jsx_runtime_1.jsx)(SpeechButton, { className: "speech-button", disabled: !canSendMessage }), loading ? ((0, jsx_runtime_1.jsx)(LoadingButton, { type: "default" })) : ((0, jsx_runtime_1.jsx)(SendButton, { type: "primary", disabled: !canSendMessage }))] }));
|
|
181
|
+
} })] }));
|
|
208
182
|
};
|
|
209
183
|
exports.ChatInput = ChatInput;
|
|
210
|
-
//# sourceMappingURL=ChatInput.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { AgentSimulatorInfo } from "../services/agent-service";
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { AgentSimulatorInfo } from "../services/agent-service";
|
|
3
3
|
import type { DebugStatusType } from "./ToolBar";
|
|
4
4
|
interface LogPanelProps {
|
|
5
5
|
open: boolean;
|
|
@@ -12,4 +12,3 @@ interface LogPanelProps {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const LogPanel: React.FC<LogPanelProps>;
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=LogPanel.d.ts.map
|
|
@@ -20,7 +20,11 @@ const LogPanel = ({ open, activeTab, onTabChange, onClose, agentSimulatorInfo, h
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
return ((0, jsx_runtime_1.jsxs)(antd_1.Drawer, { placement: "bottom", open: open, onClose: onClose, height: height, mask: true, maskClosable: true, styles: {
|
|
23
|
-
body: {
|
|
23
|
+
body: {
|
|
24
|
+
padding: 0,
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
},
|
|
24
28
|
header: { display: "none" },
|
|
25
29
|
}, destroyOnClose: false, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
26
30
|
borderBottom: `1px solid ${token.colorBorder}`,
|
|
@@ -56,4 +60,3 @@ const LogPanel = ({ open, activeTab, onTabChange, onClose, agentSimulatorInfo, h
|
|
|
56
60
|
}, children: "Agent \u670D\u52A1\u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u83B7\u53D6\u7528\u6237\u65E5\u5FD7" })))] })] }));
|
|
57
61
|
};
|
|
58
62
|
exports.LogPanel = LogPanel;
|
|
59
|
-
//# sourceMappingURL=LogPanel.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type React from "react";
|
|
2
2
|
import { LogType } from "../services/logger-service";
|
|
3
3
|
import type { DebugStatusType } from "./ToolBar";
|
|
4
4
|
interface SystemLogsProps {
|
|
@@ -27,4 +27,3 @@ export declare enum AgentType {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const SystemLogs: React.FC<SystemLogsProps>;
|
|
29
29
|
export {};
|
|
30
|
-
//# sourceMappingURL=SystemLogs.d.ts.map
|
|
@@ -238,7 +238,10 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
238
238
|
});
|
|
239
239
|
if (response.success) {
|
|
240
240
|
// @ts-ignore
|
|
241
|
-
const newRemoteLogs = response.data.map((log) => ({
|
|
241
|
+
const newRemoteLogs = response.data.map((log) => ({
|
|
242
|
+
...log,
|
|
243
|
+
source: "remote",
|
|
244
|
+
}));
|
|
242
245
|
if (isLoadMore) {
|
|
243
246
|
// 加载更多:追加日志
|
|
244
247
|
setLogs((prevLogs) => [...prevLogs, ...newRemoteLogs]);
|
|
@@ -276,7 +279,9 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
276
279
|
"@timestamp": new Date().toISOString(),
|
|
277
280
|
level: "error",
|
|
278
281
|
eventId: "",
|
|
279
|
-
message: JSON.stringify({
|
|
282
|
+
message: JSON.stringify({
|
|
283
|
+
msg: `日志获取失败: ${error.message}`,
|
|
284
|
+
}),
|
|
280
285
|
source: "local",
|
|
281
286
|
};
|
|
282
287
|
setLogs((prevLogs) => [...prevLogs, errorLog]);
|
|
@@ -303,14 +308,18 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
303
308
|
"@timestamp": new Date().toISOString(),
|
|
304
309
|
level: "system",
|
|
305
310
|
eventId: "",
|
|
306
|
-
message: JSON.stringify({
|
|
311
|
+
message: JSON.stringify({
|
|
312
|
+
msg: `👤 用户日志拉取成功 ${new Date().toLocaleString()}`,
|
|
313
|
+
}),
|
|
307
314
|
source: "local",
|
|
308
315
|
}
|
|
309
316
|
: {
|
|
310
317
|
"@timestamp": new Date().toISOString(),
|
|
311
318
|
level: "system",
|
|
312
319
|
eventId: "",
|
|
313
|
-
message: JSON.stringify({
|
|
320
|
+
message: JSON.stringify({
|
|
321
|
+
msg: `🖥️ 系统日志拉取成功 ${new Date().toLocaleString()}`,
|
|
322
|
+
}),
|
|
314
323
|
source: "local",
|
|
315
324
|
},
|
|
316
325
|
{
|
|
@@ -324,7 +333,9 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
324
333
|
"@timestamp": new Date().toISOString(),
|
|
325
334
|
level: "system",
|
|
326
335
|
eventId: "",
|
|
327
|
-
message: JSON.stringify({
|
|
336
|
+
message: JSON.stringify({
|
|
337
|
+
msg: `Agent '${agentName}' 已加载`,
|
|
338
|
+
}),
|
|
328
339
|
source: "local",
|
|
329
340
|
},
|
|
330
341
|
];
|
|
@@ -349,7 +360,9 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
349
360
|
"@timestamp": new Date().toISOString(),
|
|
350
361
|
level: debugStatus === "normal" ? "system" : "warn",
|
|
351
362
|
eventId: "",
|
|
352
|
-
message: JSON.stringify({
|
|
363
|
+
message: JSON.stringify({
|
|
364
|
+
msg: `调试状态变更: ${debugStatus}`,
|
|
365
|
+
}),
|
|
353
366
|
source: "local",
|
|
354
367
|
};
|
|
355
368
|
setLogs((prevLogs) => [...prevLogs, statusLog]);
|
|
@@ -396,7 +409,10 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
396
409
|
loadMoreWithThrottle();
|
|
397
410
|
}
|
|
398
411
|
}, [loadMoreWithThrottle]);
|
|
399
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "system-logs", style: {
|
|
412
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "system-logs", style: {
|
|
413
|
+
height: "100%",
|
|
414
|
+
backgroundColor: token.colorBgElevated,
|
|
415
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "logs-content", style: { height: "100%", margin: 0 }, children: [debugStatus !== "normal" && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
400
416
|
background: "rgba(250, 173, 20, 0.1)",
|
|
401
417
|
color: "#faad14",
|
|
402
418
|
padding: "8px 16px",
|
|
@@ -441,7 +457,9 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
441
457
|
color: "#a3a3a3",
|
|
442
458
|
whiteSpace: "pre-wrap",
|
|
443
459
|
wordBreak: "break-all",
|
|
444
|
-
}, children: logType === logger_service_1.LogType.USERCODE
|
|
460
|
+
}, children: logType === logger_service_1.LogType.USERCODE
|
|
461
|
+
? formatUserLogDetailedInfo(entry)
|
|
462
|
+
: formatDetailedInfo(entry) }))] }, index));
|
|
445
463
|
}), isLoadingMore && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
446
464
|
textAlign: "center",
|
|
447
465
|
padding: "16px",
|
|
@@ -457,4 +475,3 @@ const SystemLogs = ({ baseUrl, agentName, debugStatus, isOpen = false, logType =
|
|
|
457
475
|
}, children: ["\u5DF2\u52A0\u8F7D\u5168\u90E8\u65E5\u5FD7 (", logs.filter((log) => log.source === "remote").length, " \u6761)"] }))] })] }) }));
|
|
458
476
|
};
|
|
459
477
|
exports.SystemLogs = SystemLogs;
|
|
460
|
-
//# sourceMappingURL=SystemLogs.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { FunctionMode } from "../hooks/useAgentStatus";
|
|
3
|
+
import type { AgentSimulatorInfo } from "../services/agent-service";
|
|
3
4
|
export type DebugStatusType = "normal" | "stopped" | "error" | "connecting" | "timeout";
|
|
4
5
|
export interface ToolBarProps {
|
|
5
6
|
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
@@ -9,10 +10,10 @@ export interface ToolBarProps {
|
|
|
9
10
|
onRetryConnection: () => void;
|
|
10
11
|
onClearChat: () => void;
|
|
11
12
|
onToggleLogs: () => void;
|
|
13
|
+
functionMode?: FunctionMode;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* 工具栏组件
|
|
15
17
|
* 提供调试控制和系统状态显示
|
|
16
18
|
*/
|
|
17
19
|
export declare const ToolBar: React.FC<ToolBarProps>;
|
|
18
|
-
//# sourceMappingURL=ToolBar.d.ts.map
|
|
@@ -9,7 +9,7 @@ const AuthIndicator_1 = require("../components/AuthIndicator");
|
|
|
9
9
|
* 工具栏组件
|
|
10
10
|
* 提供调试控制和系统状态显示
|
|
11
11
|
*/
|
|
12
|
-
const ToolBar = ({ agentSimulatorInfo, debugStatus, showSystemLogs, isConnecting = false, onRetryConnection, onClearChat, onToggleLogs, }) => {
|
|
12
|
+
const ToolBar = ({ agentSimulatorInfo, debugStatus, showSystemLogs, isConnecting = false, onRetryConnection, onClearChat, onToggleLogs, functionMode = "agent", }) => {
|
|
13
13
|
const { token } = antd_1.theme.useToken();
|
|
14
14
|
// 获取调试状态显示文本
|
|
15
15
|
const getDebugStatusText = () => {
|
|
@@ -37,7 +37,7 @@ const ToolBar = ({ agentSimulatorInfo, debugStatus, showSystemLogs, isConnecting
|
|
|
37
37
|
await navigator.clipboard.writeText(agentId);
|
|
38
38
|
antd_1.message.success("AgentId 已复制到剪贴板");
|
|
39
39
|
}
|
|
40
|
-
catch (
|
|
40
|
+
catch (_err) {
|
|
41
41
|
// 兼容旧浏览器
|
|
42
42
|
const textArea = document.createElement("textarea");
|
|
43
43
|
textArea.value = agentId;
|
|
@@ -66,7 +66,10 @@ const ToolBar = ({ agentSimulatorInfo, debugStatus, showSystemLogs, isConnecting
|
|
|
66
66
|
display: "inline-flex",
|
|
67
67
|
alignItems: "center",
|
|
68
68
|
gap: 8,
|
|
69
|
-
}, children: [agentSimulatorInfo?.agentInfo?.agent_name || "未连接", (0, jsx_runtime_1.jsx)(
|
|
69
|
+
}, children: [agentSimulatorInfo?.agentInfo?.agent_name || "未连接", functionMode === "websocket" && ((0, jsx_runtime_1.jsx)(antd_1.Tag, { color: "blue", style: { margin: 0, fontSize: 10, lineHeight: "16px", padding: "0 4px" }, children: "WS" })), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
70
|
+
display: "inline-flex",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
}, children: (0, jsx_runtime_1.jsx)(AuthIndicator_1.AuthIndicator, {}) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "agent-info-right", children: (0, jsx_runtime_1.jsxs)("div", { className: "agent-id-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "agent-id-value", title: agentSimulatorInfo?.agentInfo?.agent_id || "获取中...", style: {
|
|
70
73
|
color: token.colorText,
|
|
71
74
|
}, children: agentSimulatorInfo?.agentInfo?.agent_id || "获取中..." }), agentSimulatorInfo?.agentInfo?.agent_id && ((0, jsx_runtime_1.jsx)(antd_1.Button, { className: "copy-icon", type: "text", size: "small", icon: (0, jsx_runtime_1.jsx)(icons_1.CopyOutlined, {}), onClick: copyAgentId, title: "\u70B9\u51FB\u590D\u5236 AgentId", style: {
|
|
72
75
|
padding: "0 4px",
|
|
@@ -87,4 +90,3 @@ const ToolBar = ({ agentSimulatorInfo, debugStatus, showSystemLogs, isConnecting
|
|
|
87
90
|
}, children: isConnecting ? "连接中..." : "重试连接" })] })] })] }));
|
|
88
91
|
};
|
|
89
92
|
exports.ToolBar = ToolBar;
|
|
90
|
-
//# sourceMappingURL=ToolBar.js.map
|