@vectorx/agent-simulator 0.0.0-beta-20251112071234
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/README.md +76 -0
- package/bin/agent.js +55 -0
- package/lib/app.d.ts +43 -0
- package/lib/app.d.ts.map +1 -0
- package/lib/app.js +99 -0
- package/lib/app.js.map +1 -0
- package/lib/config/api.config.d.ts +2 -0
- package/lib/config/api.config.d.ts.map +1 -0
- package/lib/config/api.config.js +13 -0
- package/lib/config/api.config.js.map +1 -0
- package/lib/config/app.config.d.ts +22 -0
- package/lib/config/app.config.d.ts.map +1 -0
- package/lib/config/app.config.js +18 -0
- package/lib/config/app.config.js.map +1 -0
- package/lib/config/upload.config.d.ts +6 -0
- package/lib/config/upload.config.d.ts.map +1 -0
- package/lib/config/upload.config.js +10 -0
- package/lib/config/upload.config.js.map +1 -0
- package/lib/container/container.d.ts +6 -0
- package/lib/container/container.d.ts.map +1 -0
- package/lib/container/container.js +34 -0
- package/lib/container/container.js.map +1 -0
- package/lib/container/identifiers.d.ts +14 -0
- package/lib/container/identifiers.d.ts.map +1 -0
- package/lib/container/identifiers.js +20 -0
- package/lib/container/identifiers.js.map +1 -0
- package/lib/container/index.d.ts +4 -0
- package/lib/container/index.d.ts.map +1 -0
- package/lib/container/index.js +20 -0
- package/lib/container/index.js.map +1 -0
- package/lib/container/types.d.ts +48 -0
- package/lib/container/types.d.ts.map +1 -0
- package/lib/container/types.js +3 -0
- package/lib/container/types.js.map +1 -0
- package/lib/controllers/agent.controller.d.ts +19 -0
- package/lib/controllers/agent.controller.d.ts.map +1 -0
- package/lib/controllers/agent.controller.js +102 -0
- package/lib/controllers/agent.controller.js.map +1 -0
- package/lib/controllers/auth.controller.d.ts +23 -0
- package/lib/controllers/auth.controller.d.ts.map +1 -0
- package/lib/controllers/auth.controller.js +132 -0
- package/lib/controllers/auth.controller.js.map +1 -0
- package/lib/controllers/simulator.controller.d.ts +11 -0
- package/lib/controllers/simulator.controller.d.ts.map +1 -0
- package/lib/controllers/simulator.controller.js +44 -0
- package/lib/controllers/simulator.controller.js.map +1 -0
- package/lib/controllers/upload.controller.d.ts +8 -0
- package/lib/controllers/upload.controller.d.ts.map +1 -0
- package/lib/controllers/upload.controller.js +44 -0
- package/lib/controllers/upload.controller.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/middleware/cors.middleware.d.ts +7 -0
- package/lib/middleware/cors.middleware.d.ts.map +1 -0
- package/lib/middleware/cors.middleware.js +14 -0
- package/lib/middleware/cors.middleware.js.map +1 -0
- package/lib/middleware/error.middleware.d.ts +8 -0
- package/lib/middleware/error.middleware.d.ts.map +1 -0
- package/lib/middleware/error.middleware.js +33 -0
- package/lib/middleware/error.middleware.js.map +1 -0
- package/lib/middleware/proxy.middleware.d.ts +3 -0
- package/lib/middleware/proxy.middleware.d.ts.map +1 -0
- package/lib/middleware/proxy.middleware.js +21 -0
- package/lib/middleware/proxy.middleware.js.map +1 -0
- package/lib/middleware/upload.middleware.d.ts +10 -0
- package/lib/middleware/upload.middleware.d.ts.map +1 -0
- package/lib/middleware/upload.middleware.js +27 -0
- package/lib/middleware/upload.middleware.js.map +1 -0
- package/lib/routes/agent.d.ts +3 -0
- package/lib/routes/agent.d.ts.map +1 -0
- package/lib/routes/agent.js +19 -0
- package/lib/routes/agent.js.map +1 -0
- package/lib/routes/auth.d.ts +3 -0
- package/lib/routes/auth.d.ts.map +1 -0
- package/lib/routes/auth.js +20 -0
- package/lib/routes/auth.js.map +1 -0
- package/lib/routes/index.d.ts +3 -0
- package/lib/routes/index.d.ts.map +1 -0
- package/lib/routes/index.js +19 -0
- package/lib/routes/index.js.map +1 -0
- package/lib/routes/simulator.d.ts +3 -0
- package/lib/routes/simulator.d.ts.map +1 -0
- package/lib/routes/simulator.js +14 -0
- package/lib/routes/simulator.js.map +1 -0
- package/lib/routes/upload.d.ts +3 -0
- package/lib/routes/upload.d.ts.map +1 -0
- package/lib/routes/upload.js +13 -0
- package/lib/routes/upload.js.map +1 -0
- package/lib/services/agent.service.d.ts +49 -0
- package/lib/services/agent.service.d.ts.map +1 -0
- package/lib/services/agent.service.js +147 -0
- package/lib/services/agent.service.js.map +1 -0
- package/lib/services/auth.service.d.ts +55 -0
- package/lib/services/auth.service.d.ts.map +1 -0
- package/lib/services/auth.service.js +124 -0
- package/lib/services/auth.service.js.map +1 -0
- package/lib/services/simulator.service.d.ts +23 -0
- package/lib/services/simulator.service.d.ts.map +1 -0
- package/lib/services/simulator.service.js +49 -0
- package/lib/services/simulator.service.js.map +1 -0
- package/lib/services/upload.service.d.ts +32 -0
- package/lib/services/upload.service.d.ts.map +1 -0
- package/lib/services/upload.service.js +61 -0
- package/lib/services/upload.service.js.map +1 -0
- package/lib/simulator.d.ts +27 -0
- package/lib/simulator.d.ts.map +1 -0
- package/lib/simulator.js +79 -0
- package/lib/simulator.js.map +1 -0
- package/lib/utils/logger.d.ts +8 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +28 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/request.d.ts +11 -0
- package/lib/utils/request.d.ts.map +1 -0
- package/lib/utils/request.js +36 -0
- package/lib/utils/request.js.map +1 -0
- package/lib/utils/url-parser.d.ts +14 -0
- package/lib/utils/url-parser.d.ts.map +1 -0
- package/lib/utils/url-parser.js +25 -0
- package/lib/utils/url-parser.js.map +1 -0
- package/lib/utils.d.ts +6 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +12 -0
- package/lib/utils.js.map +1 -0
- package/lib/webview-ui/Agent.d.ts +5 -0
- package/lib/webview-ui/Agent.d.ts.map +1 -0
- package/lib/webview-ui/Agent.js +24 -0
- package/lib/webview-ui/Agent.js.map +1 -0
- package/lib/webview-ui/App.d.ts +3 -0
- package/lib/webview-ui/App.d.ts.map +1 -0
- package/lib/webview-ui/App.js +775 -0
- package/lib/webview-ui/App.js.map +1 -0
- package/lib/webview-ui/ErrorBoundary.d.ts +19 -0
- package/lib/webview-ui/ErrorBoundary.d.ts.map +1 -0
- package/lib/webview-ui/ErrorBoundary.js +54 -0
- package/lib/webview-ui/ErrorBoundary.js.map +1 -0
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts +13 -0
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts.map +1 -0
- package/lib/webview-ui/components/AsyncTaskBlock.js +179 -0
- package/lib/webview-ui/components/AsyncTaskBlock.js.map +1 -0
- package/lib/webview-ui/components/AuthIndicator.d.ts +3 -0
- package/lib/webview-ui/components/AuthIndicator.d.ts.map +1 -0
- package/lib/webview-ui/components/AuthIndicator.js +17 -0
- package/lib/webview-ui/components/AuthIndicator.js.map +1 -0
- package/lib/webview-ui/components/ErrorCard.d.ts +11 -0
- package/lib/webview-ui/components/ErrorCard.d.ts.map +1 -0
- package/lib/webview-ui/components/ErrorCard.js +18 -0
- package/lib/webview-ui/components/ErrorCard.js.map +1 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +20 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts.map +1 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +45 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js.map +1 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts +9 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts.map +1 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +31 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js.map +1 -0
- package/lib/webview-ui/components/MarkdownRenderer.d.ts +7 -0
- package/lib/webview-ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/lib/webview-ui/components/MarkdownRenderer.js +28 -0
- package/lib/webview-ui/components/MarkdownRenderer.js.map +1 -0
- package/lib/webview-ui/components/MessageRenderer.d.ts +7 -0
- package/lib/webview-ui/components/MessageRenderer.d.ts.map +1 -0
- package/lib/webview-ui/components/MessageRenderer.js +33 -0
- package/lib/webview-ui/components/MessageRenderer.js.map +1 -0
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts +20 -0
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts.map +1 -0
- package/lib/webview-ui/components/MultimodalFileRenderer.js +216 -0
- package/lib/webview-ui/components/MultimodalFileRenderer.js.map +1 -0
- package/lib/webview-ui/components/ThinkingBlock.d.ts +8 -0
- package/lib/webview-ui/components/ThinkingBlock.d.ts.map +1 -0
- package/lib/webview-ui/components/ThinkingBlock.js +75 -0
- package/lib/webview-ui/components/ThinkingBlock.js.map +1 -0
- package/lib/webview-ui/components/ToolUseBlock.d.ts +10 -0
- package/lib/webview-ui/components/ToolUseBlock.d.ts.map +1 -0
- package/lib/webview-ui/components/ToolUseBlock.js +14 -0
- package/lib/webview-ui/components/ToolUseBlock.js.map +1 -0
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts +10 -0
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts.map +1 -0
- package/lib/webview-ui/components/ToolUseBlockHeader.js +31 -0
- package/lib/webview-ui/components/ToolUseBlockHeader.js.map +1 -0
- package/lib/webview-ui/components/UploadPreview.d.ts +6 -0
- package/lib/webview-ui/components/UploadPreview.d.ts.map +1 -0
- package/lib/webview-ui/components/UploadPreview.js +12 -0
- package/lib/webview-ui/components/UploadPreview.js.map +1 -0
- package/lib/webview-ui/components/WelcomeModule.d.ts +10 -0
- package/lib/webview-ui/components/WelcomeModule.d.ts.map +1 -0
- package/lib/webview-ui/components/WelcomeModule.js +161 -0
- package/lib/webview-ui/components/WelcomeModule.js.map +1 -0
- package/lib/webview-ui/components/index.d.ts +14 -0
- package/lib/webview-ui/components/index.d.ts.map +1 -0
- package/lib/webview-ui/components/index.js +30 -0
- package/lib/webview-ui/components/index.js.map +1 -0
- package/lib/webview-ui/config/cos-config.d.ts +41 -0
- package/lib/webview-ui/config/cos-config.d.ts.map +1 -0
- package/lib/webview-ui/config/cos-config.js +83 -0
- package/lib/webview-ui/config/cos-config.js.map +1 -0
- package/lib/webview-ui/config/http-config.d.ts +8 -0
- package/lib/webview-ui/config/http-config.d.ts.map +1 -0
- package/lib/webview-ui/config/http-config.js +36 -0
- package/lib/webview-ui/config/http-config.js.map +1 -0
- package/lib/webview-ui/constants.d.ts +18 -0
- package/lib/webview-ui/constants.d.ts.map +1 -0
- package/lib/webview-ui/constants.js +25 -0
- package/lib/webview-ui/constants.js.map +1 -0
- package/lib/webview-ui/contexts/AgentContext.d.ts +13 -0
- package/lib/webview-ui/contexts/AgentContext.d.ts.map +1 -0
- package/lib/webview-ui/contexts/AgentContext.js +19 -0
- package/lib/webview-ui/contexts/AgentContext.js.map +1 -0
- package/lib/webview-ui/contexts/AuthContext.d.ts +17 -0
- package/lib/webview-ui/contexts/AuthContext.d.ts.map +1 -0
- package/lib/webview-ui/contexts/AuthContext.js +79 -0
- package/lib/webview-ui/contexts/AuthContext.js.map +1 -0
- package/lib/webview-ui/contexts/ThemeContext.d.ts +12 -0
- package/lib/webview-ui/contexts/ThemeContext.d.ts.map +1 -0
- package/lib/webview-ui/contexts/ThemeContext.js +21 -0
- package/lib/webview-ui/contexts/ThemeContext.js.map +1 -0
- package/lib/webview-ui/hooks/useAgentStatus.d.ts +17 -0
- package/lib/webview-ui/hooks/useAgentStatus.d.ts.map +1 -0
- package/lib/webview-ui/hooks/useAgentStatus.js +117 -0
- package/lib/webview-ui/hooks/useAgentStatus.js.map +1 -0
- package/lib/webview-ui/hooks/useUploader.d.ts +19 -0
- package/lib/webview-ui/hooks/useUploader.d.ts.map +1 -0
- package/lib/webview-ui/hooks/useUploader.js +132 -0
- package/lib/webview-ui/hooks/useUploader.js.map +1 -0
- package/lib/webview-ui/hooks/useUserAvatar.d.ts +28 -0
- package/lib/webview-ui/hooks/useUserAvatar.d.ts.map +1 -0
- package/lib/webview-ui/hooks/useUserAvatar.js +74 -0
- package/lib/webview-ui/hooks/useUserAvatar.js.map +1 -0
- package/lib/webview-ui/index.d.ts +3 -0
- package/lib/webview-ui/index.d.ts.map +1 -0
- package/lib/webview-ui/index.js +17 -0
- package/lib/webview-ui/index.js.map +1 -0
- package/lib/webview-ui/services/agent-service.d.ts +124 -0
- package/lib/webview-ui/services/agent-service.d.ts.map +1 -0
- package/lib/webview-ui/services/agent-service.js +80 -0
- package/lib/webview-ui/services/agent-service.js.map +1 -0
- package/lib/webview-ui/services/index.d.ts +3 -0
- package/lib/webview-ui/services/index.d.ts.map +1 -0
- package/lib/webview-ui/services/index.js +19 -0
- package/lib/webview-ui/services/index.js.map +1 -0
- package/lib/webview-ui/services/logger-service.d.ts +46 -0
- package/lib/webview-ui/services/logger-service.d.ts.map +1 -0
- package/lib/webview-ui/services/logger-service.js +69 -0
- package/lib/webview-ui/services/logger-service.js.map +1 -0
- package/lib/webview-ui/styles/copilot.d.ts +14 -0
- package/lib/webview-ui/styles/copilot.d.ts.map +1 -0
- package/lib/webview-ui/styles/copilot.js +119 -0
- package/lib/webview-ui/styles/copilot.js.map +1 -0
- package/lib/webview-ui/styles/workarea.d.ts +11 -0
- package/lib/webview-ui/styles/workarea.d.ts.map +1 -0
- package/lib/webview-ui/styles/workarea.js +73 -0
- package/lib/webview-ui/styles/workarea.js.map +1 -0
- package/lib/webview-ui/types.d.ts +65 -0
- package/lib/webview-ui/types.d.ts.map +1 -0
- package/lib/webview-ui/types.js +3 -0
- package/lib/webview-ui/types.js.map +1 -0
- package/lib/webview-ui/utils/cos.d.ts +65 -0
- package/lib/webview-ui/utils/cos.d.ts.map +1 -0
- package/lib/webview-ui/utils/cos.js +113 -0
- package/lib/webview-ui/utils/cos.js.map +1 -0
- package/lib/webview-ui/utils/http-client.d.ts +44 -0
- package/lib/webview-ui/utils/http-client.d.ts.map +1 -0
- package/lib/webview-ui/utils/http-client.js +101 -0
- package/lib/webview-ui/utils/http-client.js.map +1 -0
- package/lib/webview-ui/utils/stream-text-handler.d.ts +4 -0
- package/lib/webview-ui/utils/stream-text-handler.d.ts.map +1 -0
- package/lib/webview-ui/utils/stream-text-handler.js +54 -0
- package/lib/webview-ui/utils/stream-text-handler.js.map +1 -0
- package/lib/webview-ui/utils/upload.d.ts +8 -0
- package/lib/webview-ui/utils/upload.d.ts.map +1 -0
- package/lib/webview-ui/utils/upload.js +22 -0
- package/lib/webview-ui/utils/upload.js.map +1 -0
- package/lib/webview-ui/widgets/BubbleComponents.d.ts +8 -0
- package/lib/webview-ui/widgets/BubbleComponents.d.ts.map +1 -0
- package/lib/webview-ui/widgets/BubbleComponents.js +62 -0
- package/lib/webview-ui/widgets/BubbleComponents.js.map +1 -0
- package/lib/webview-ui/widgets/ChatInput.d.ts +27 -0
- package/lib/webview-ui/widgets/ChatInput.d.ts.map +1 -0
- package/lib/webview-ui/widgets/ChatInput.js +203 -0
- package/lib/webview-ui/widgets/ChatInput.js.map +1 -0
- package/lib/webview-ui/widgets/LogPanel.d.ts +15 -0
- package/lib/webview-ui/widgets/LogPanel.d.ts.map +1 -0
- package/lib/webview-ui/widgets/LogPanel.js +59 -0
- package/lib/webview-ui/widgets/LogPanel.js.map +1 -0
- package/lib/webview-ui/widgets/SystemLogs.d.ts +30 -0
- package/lib/webview-ui/widgets/SystemLogs.d.ts.map +1 -0
- package/lib/webview-ui/widgets/SystemLogs.js +460 -0
- package/lib/webview-ui/widgets/SystemLogs.js.map +1 -0
- package/lib/webview-ui/widgets/ToolBar.d.ts +18 -0
- package/lib/webview-ui/widgets/ToolBar.d.ts.map +1 -0
- package/lib/webview-ui/widgets/ToolBar.js +90 -0
- package/lib/webview-ui/widgets/ToolBar.js.map +1 -0
- package/lib/webview-ui/widgets/index.d.ts +6 -0
- package/lib/webview-ui/widgets/index.d.ts.map +1 -0
- package/lib/webview-ui/widgets/index.js +22 -0
- package/lib/webview-ui/widgets/index.js.map +1 -0
- package/package.json +92 -0
- package/public/assets/index-j_rEEDWU.js +93 -0
- package/public/assets/main.js +603 -0
- package/public/assets/style.css +1 -0
- package/public/index.html +15 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AgentController = void 0;
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
17
|
+
const identifiers_1 = require("../container/identifiers");
|
|
18
|
+
let AgentController = class AgentController {
|
|
19
|
+
constructor(agentService) {
|
|
20
|
+
/**
|
|
21
|
+
* 获取Agent信息
|
|
22
|
+
*/
|
|
23
|
+
this.getAgentInfo = async (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const agentInfo = await this.agentService.getAgentInfo();
|
|
26
|
+
res.json(agentInfo);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error("获取Agent信息失败:", error);
|
|
30
|
+
res.status(500).json({
|
|
31
|
+
error: error instanceof Error ? error.message : `获取Agent信息失败: ${error}`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 获取Agent状态
|
|
37
|
+
*/
|
|
38
|
+
this.getAgentStatus = async (req, res) => {
|
|
39
|
+
try {
|
|
40
|
+
const status = await this.agentService.getAgentStatus();
|
|
41
|
+
res.json(status);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error("获取Agent状态失败:", error);
|
|
45
|
+
res.status(500).json({
|
|
46
|
+
error: error instanceof Error ? error.message : `获取Agent状态失败: ${error}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 上传文件(使用 multipart/form-data,对齐 OpenAI 标准)
|
|
52
|
+
*/
|
|
53
|
+
this.uploadFile = async (req, res) => {
|
|
54
|
+
try {
|
|
55
|
+
// multer 会将文件存储在 req.file 中
|
|
56
|
+
const file = req.file;
|
|
57
|
+
if (!file) {
|
|
58
|
+
res.status(400).json({
|
|
59
|
+
code: 400,
|
|
60
|
+
message: "请上传文件(字段名: file)",
|
|
61
|
+
data: null,
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// 从 form data 中获取 purpose 参数(可选)
|
|
66
|
+
const purpose = req.body.purpose || "file-extract";
|
|
67
|
+
console.log(`==== 接收到文件上传请求 ====`);
|
|
68
|
+
console.log(`文件名: ${file.originalname}`);
|
|
69
|
+
console.log(`MIME类型: ${file.mimetype}`);
|
|
70
|
+
console.log(`用途: ${purpose}`);
|
|
71
|
+
console.log(`文件大小: ${file.size} bytes`);
|
|
72
|
+
const result = await this.agentService.uploadFile({
|
|
73
|
+
filename: file.originalname,
|
|
74
|
+
fileContent: file.buffer,
|
|
75
|
+
purpose,
|
|
76
|
+
mimeType: file.mimetype,
|
|
77
|
+
});
|
|
78
|
+
res.json({
|
|
79
|
+
code: 0,
|
|
80
|
+
message: "文件上传成功",
|
|
81
|
+
data: result,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error("文件上传失败:", error);
|
|
86
|
+
res.status(500).json({
|
|
87
|
+
code: 500,
|
|
88
|
+
message: error instanceof Error ? error.message : `文件上传失败: ${error}`,
|
|
89
|
+
data: null,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
this.agentService = agentService;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.AgentController = AgentController;
|
|
97
|
+
exports.AgentController = AgentController = __decorate([
|
|
98
|
+
(0, inversify_1.injectable)(),
|
|
99
|
+
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.AgentService)),
|
|
100
|
+
__metadata("design:paramtypes", [Object])
|
|
101
|
+
], AgentController);
|
|
102
|
+
//# sourceMappingURL=agent.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.controller.js","sourceRoot":"","sources":["../../src/controllers/agent.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,yCAA+C;AAC/C,0DAA+D;AAIxD,IAAM,eAAe,GAArB,MAAM,eAAe;IAG1B,YAAsD,YAA2B;QAIjF;;WAEG;QACH,iBAAY,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAiB,EAAE;YAClE,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBACzD,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;gBACrC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,KAAK,EAAE;iBACxE,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QAEF;;WAEG;QACH,mBAAc,GAAG,K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BAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC;gBAExC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;oBAChD,QAAQ,EAAE,IAAI,CAAC,YAAY;oBAC3B,WAAW,EAAE,IAAI,CAAC,MAAM;oBACxB,OAAO;oBACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,CAAC;gBAEH,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI,EAAE,CAAC;oBACP,OAAO,EAAE,QAAQ;oBACjB,IAAI,EAAE,MAAM;iBACb,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBAChC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,IAAI,EAAE,GAAG;oBACT,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE;oBACpE,IAAI,EAAE,IAAI;iBACX,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QA/EA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CA+EF,CAAA;AApFY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;IAIE,WAAA,IAAA,kBAAM,EAAC,iCAAmB,CAAC,YAAY,CAAC,CAAA;;GAH1C,eAAe,CAoF3B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
import type { IAuthController, IAuthService } from "../container/types";
|
|
3
|
+
export declare class AuthController implements IAuthController {
|
|
4
|
+
private authService;
|
|
5
|
+
constructor(authService: IAuthService);
|
|
6
|
+
/**
|
|
7
|
+
* 获取认证状态
|
|
8
|
+
*/
|
|
9
|
+
getAuthStatus: (req: Request, res: Response) => Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取登录信息
|
|
12
|
+
*/
|
|
13
|
+
getLoginInfo: (req: Request, res: Response) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 检查是否已登录
|
|
16
|
+
*/
|
|
17
|
+
hasLogin: (req: Request, res: Response) => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* 检查登录状态(调用下游服务)
|
|
20
|
+
*/
|
|
21
|
+
checkLoginStatus: (req: Request, res: Response) => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=auth.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExE,qBACa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,WAAW,CAAe;gBAEmB,WAAW,EAAE,YAAY;IAI9E;;OAEG;IACH,aAAa,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAehE;IAEF;;OAEG;IACH,YAAY,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAyB/D;IAEF;;OAEG;IACH,QAAQ,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAiB3D;IAEF;;OAEG;IACH,gBAAgB,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CA+BnE;CACH"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthController = void 0;
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
17
|
+
const identifiers_1 = require("../container/identifiers");
|
|
18
|
+
let AuthController = class AuthController {
|
|
19
|
+
constructor(authService) {
|
|
20
|
+
/**
|
|
21
|
+
* 获取认证状态
|
|
22
|
+
*/
|
|
23
|
+
this.getAuthStatus = async (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const authStatus = await this.authService.getAuthStatus();
|
|
26
|
+
res.json({
|
|
27
|
+
code: 0,
|
|
28
|
+
message: "获取认证状态成功",
|
|
29
|
+
data: authStatus,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
res.status(500).json({
|
|
34
|
+
code: 500,
|
|
35
|
+
message: `获取认证状态失败: ${error instanceof Error ? error.message : "未知错误"}`,
|
|
36
|
+
data: null,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 获取登录信息
|
|
42
|
+
*/
|
|
43
|
+
this.getLoginInfo = async (req, res) => {
|
|
44
|
+
try {
|
|
45
|
+
const loginInfo = await this.authService.getLoginInfo();
|
|
46
|
+
if (!loginInfo) {
|
|
47
|
+
res.status(401).json({
|
|
48
|
+
code: 401,
|
|
49
|
+
message: "未登录或登录已过期",
|
|
50
|
+
data: null,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
res.json({
|
|
55
|
+
code: 0,
|
|
56
|
+
message: "获取登录信息成功",
|
|
57
|
+
data: loginInfo,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
res.status(500).json({
|
|
62
|
+
code: 500,
|
|
63
|
+
message: `获取登录信息失败: ${error instanceof Error ? error.message : "未知错误"}`,
|
|
64
|
+
data: null,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* 检查是否已登录
|
|
70
|
+
*/
|
|
71
|
+
this.hasLogin = async (req, res) => {
|
|
72
|
+
try {
|
|
73
|
+
const isLoggedIn = this.authService.hasLogin();
|
|
74
|
+
res.json({
|
|
75
|
+
code: 0,
|
|
76
|
+
message: "检查登录状态成功",
|
|
77
|
+
data: {
|
|
78
|
+
isLoggedIn,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
res.status(500).json({
|
|
84
|
+
code: 500,
|
|
85
|
+
message: `检查登录状态失败: ${error instanceof Error ? error.message : "未知错误"}`,
|
|
86
|
+
data: null,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* 检查登录状态(调用下游服务)
|
|
92
|
+
*/
|
|
93
|
+
this.checkLoginStatus = async (req, res) => {
|
|
94
|
+
try {
|
|
95
|
+
const { secret_id, nonce, cli_token } = req.body;
|
|
96
|
+
if (!secret_id || !nonce || !cli_token) {
|
|
97
|
+
res.status(400).json({
|
|
98
|
+
code: 400,
|
|
99
|
+
message: "缺少必要参数: secret_id, nonce, cli_token",
|
|
100
|
+
data: null,
|
|
101
|
+
});
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const result = await this.authService.check({
|
|
105
|
+
secret_id,
|
|
106
|
+
nonce,
|
|
107
|
+
cli_token,
|
|
108
|
+
});
|
|
109
|
+
res.json({
|
|
110
|
+
code: 0,
|
|
111
|
+
message: "检查登录状态成功",
|
|
112
|
+
data: result,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
res.status(500).json({
|
|
117
|
+
code: 500,
|
|
118
|
+
message: `检查登录状态失败: ${error instanceof Error ? error.message : "未知错误"}`,
|
|
119
|
+
data: null,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.authService = authService;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
exports.AuthController = AuthController;
|
|
127
|
+
exports.AuthController = AuthController = __decorate([
|
|
128
|
+
(0, inversify_1.injectable)(),
|
|
129
|
+
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.AuthService)),
|
|
130
|
+
__metadata("design:paramtypes", [Object])
|
|
131
|
+
], AuthController);
|
|
132
|
+
//# sourceMappingURL=auth.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,yCAA+C;AAC/C,0DAA+D;AAIxD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGzB,YAAqD,WAAyB;QAI9E;;WAEG;QACH,kBAAa,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAiB,EAAE;YACnE,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;gBAC1D,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI,EAA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AC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,IAAI,EAAE,GAAG;oBACT,OAAO,EAAE,aAAa,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE;oBACvE,IAAI,EAAE,IAAI;iBACX,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QA7GA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CA6GF,CAAA;AAlHY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,sBAAU,GAAE;IAIE,WAAA,IAAA,kBAAM,EAAC,iCAAmB,CAAC,WAAW,CAAC,CAAA;;GAHzC,cAAc,CAkH1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
import type { ISimulatorController, ISimulatorService } from "../container/types";
|
|
3
|
+
export declare class SimulatorController implements ISimulatorController {
|
|
4
|
+
private simulatorService;
|
|
5
|
+
constructor(simulatorService: ISimulatorService);
|
|
6
|
+
/**
|
|
7
|
+
* 获取模拟器状态
|
|
8
|
+
*/
|
|
9
|
+
getSimulatorStatus: (req: Request, res: Response) => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=simulator.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulator.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/simulator.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAElF,qBACa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,gBAAgB,CAAoB;gBAEc,gBAAgB,EAAE,iBAAiB;IAI7F;;OAEG;IACH,kBAAkB,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAAI,CAUtD;CACH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SimulatorController = void 0;
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
17
|
+
const identifiers_1 = require("../container/identifiers");
|
|
18
|
+
let SimulatorController = class SimulatorController {
|
|
19
|
+
constructor(simulatorService) {
|
|
20
|
+
/**
|
|
21
|
+
* 获取模拟器状态
|
|
22
|
+
*/
|
|
23
|
+
this.getSimulatorStatus = (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const status = this.simulatorService.getSimulatorStatus();
|
|
26
|
+
res.json(status);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error("获取模拟器状态失败:", error);
|
|
30
|
+
res.status(500).json({
|
|
31
|
+
error: error instanceof Error ? error.message : `获取模拟器状态失败: ${error}`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.simulatorService = simulatorService;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.SimulatorController = SimulatorController;
|
|
39
|
+
exports.SimulatorController = SimulatorController = __decorate([
|
|
40
|
+
(0, inversify_1.injectable)(),
|
|
41
|
+
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.SimulatorService)),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], SimulatorController);
|
|
44
|
+
//# sourceMappingURL=simulator.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulator.controller.js","sourceRoot":"","sources":["../../src/controllers/simulator.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,yCAA+C;AAC/C,0DAA+D;AAIxD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAG9B,YAA0D,gBAAmC;QAI7F;;WAEG;QACH,uBAAkB,GAAG,CAAC,GAAY,EAAE,GAAa,EAAQ,EAAE;YACzD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;gBAC1D,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;gBACnC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,KAAK,EAAE;iBACtE,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QAhBA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CAgBF,CAAA;AArBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;IAIE,WAAA,IAAA,kBAAM,EAAC,iCAAmB,CAAC,gBAAgB,CAAC,CAAA;;GAH9C,mBAAmB,CAqB/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
import type { IUploadController, IUploadService } from "../container/types";
|
|
3
|
+
export declare class UploadController implements IUploadController {
|
|
4
|
+
private readonly uploadService;
|
|
5
|
+
constructor(uploadService: IUploadService);
|
|
6
|
+
getToken: (_req: Request, res: Response) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=upload.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/upload.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE5E,qBACa,gBAAiB,YAAW,iBAAiB;IACD,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,cAAc;IAErG,QAAQ,GAAU,MAAM,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAa5D;CACH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UploadController = void 0;
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
17
|
+
const identifiers_1 = require("../container/identifiers");
|
|
18
|
+
let UploadController = class UploadController {
|
|
19
|
+
constructor(uploadService) {
|
|
20
|
+
this.uploadService = uploadService;
|
|
21
|
+
this.getToken = async (_req, res) => {
|
|
22
|
+
try {
|
|
23
|
+
if (!_req.query.bizName || !_req.query.scene) {
|
|
24
|
+
throw new Error("bizName and scene are required");
|
|
25
|
+
}
|
|
26
|
+
const data = await this.uploadService.getToken({
|
|
27
|
+
bizName: _req.query.bizName,
|
|
28
|
+
scene: _req.query.scene,
|
|
29
|
+
});
|
|
30
|
+
res.json({ code: 0, message: "ok", data });
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
res.status(500).json({ code: 500, message: error?.message || "获取上传Token失败", data: null });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.UploadController = UploadController;
|
|
39
|
+
exports.UploadController = UploadController = __decorate([
|
|
40
|
+
(0, inversify_1.injectable)(),
|
|
41
|
+
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.UploadService)),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], UploadController);
|
|
44
|
+
//# sourceMappingURL=upload.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.controller.js","sourceRoot":"","sources":["../../src/controllers/upload.controller.ts"],"names":[],"m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3
|
+
export { Logger } from "./utils/logger";
|
|
4
|
+
export { AgentService } from "./services/agent.service";
|
|
5
|
+
export { SimulatorService } from "./services/simulator.service";
|
|
6
|
+
export { createAppConfig, type AppConfig, type AppContext } from "./config/app.config";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAppConfig = exports.SimulatorService = exports.AgentService = exports.Logger = exports.App = exports.AgentSimulator = void 0;
|
|
4
|
+
var simulator_1 = require("./simulator");
|
|
5
|
+
Object.defineProperty(exports, "AgentSimulator", { enumerable: true, get: function () { return simulator_1.AgentSimulator; } });
|
|
6
|
+
var app_1 = require("./app");
|
|
7
|
+
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return app_1.App; } });
|
|
8
|
+
var logger_1 = require("./utils/logger");
|
|
9
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
10
|
+
// 服务导出
|
|
11
|
+
var agent_service_1 = require("./services/agent.service");
|
|
12
|
+
Object.defineProperty(exports, "AgentService", { enumerable: true, get: function () { return agent_service_1.AgentService; } });
|
|
13
|
+
var simulator_service_1 = require("./services/simulator.service");
|
|
14
|
+
Object.defineProperty(exports, "SimulatorService", { enumerable: true, get: function () { return simulator_service_1.SimulatorService; } });
|
|
15
|
+
// 配置导出
|
|
16
|
+
var app_config_1 = require("./config/app.config");
|
|
17
|
+
Object.defineProperty(exports, "createAppConfig", { enumerable: true, get: function () { return app_config_1.createAppConfig; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,yCAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,OAAO;AACP,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,kEAAgE;AAAvD,qHAAA,gBAAgB,OAAA;AAEzB,OAAO;AACP,kDAAuF;AAA9E,6GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import cors from "cors";
|
|
2
|
+
export declare const corsMiddleware: (req: cors.CorsRequest, res: {
|
|
3
|
+
statusCode?: number | undefined;
|
|
4
|
+
setHeader(key: string, value: string): any;
|
|
5
|
+
end(): any;
|
|
6
|
+
}, next: (err?: any) => any) => void;
|
|
7
|
+
//# sourceMappingURL=cors.middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/cors.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,eAAO,MAAM,cAAc;cAMunC,CAAC;;;aAAmH,CAAC,sBADrwC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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.corsMiddleware = void 0;
|
|
7
|
+
const cors_1 = __importDefault(require("cors"));
|
|
8
|
+
exports.corsMiddleware = (0, cors_1.default)({
|
|
9
|
+
origin: true, // 允许所有来源
|
|
10
|
+
credentials: true, // 允许携带凭证
|
|
11
|
+
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
12
|
+
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"],
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=cors.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors.middleware.js","sourceRoot":"","sources":["../../src/middleware/cors.middleware.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAEX,QAAA,cAAc,GAAG,IAAA,cAAI,EAAC;IACjC,MAAM,EAAE,IAAI,EAAE,SAAS;IACvB,WAAW,EAAE,IAAI,EAAE,SAAS;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC;IACpD,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,CAAC;CACtE,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NextFunction, Request, Response } from "express";
|
|
2
|
+
export interface AppError extends Error {
|
|
3
|
+
statusCode?: number;
|
|
4
|
+
isOperational?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const errorHandler: (err: AppError, req: Request, res: Response, next: NextFunction) => void;
|
|
7
|
+
export declare const notFoundHandler: (req: Request, res: Response) => void;
|
|
8
|
+
//# sourceMappingURL=error.middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/error.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,QAAS,SAAQ,KAAK;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,GAAI,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,IAmB7F,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAQ7D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notFoundHandler = exports.errorHandler = void 0;
|
|
4
|
+
const errorHandler = (err, req, res, next) => {
|
|
5
|
+
const statusCode = err.statusCode || 500;
|
|
6
|
+
const message = err.message || "服务器内部错误";
|
|
7
|
+
console.error("Error:", {
|
|
8
|
+
message: err.message,
|
|
9
|
+
stack: err.stack,
|
|
10
|
+
url: req.url,
|
|
11
|
+
method: req.method,
|
|
12
|
+
timestamp: new Date().toISOString(),
|
|
13
|
+
});
|
|
14
|
+
res.status(statusCode).json({
|
|
15
|
+
error: {
|
|
16
|
+
message,
|
|
17
|
+
statusCode,
|
|
18
|
+
timestamp: new Date().toISOString(),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.errorHandler = errorHandler;
|
|
23
|
+
const notFoundHandler = (req, res) => {
|
|
24
|
+
res.status(404).json({
|
|
25
|
+
error: {
|
|
26
|
+
message: "未找到请求路径",
|
|
27
|
+
statusCode: 404,
|
|
28
|
+
timestamp: new Date().toISOString(),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.notFoundHandler = notFoundHandler;
|
|
33
|
+
//# sourceMappingURL=error.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.middleware.js","sourceRoot":"","sources":["../../src/middleware/error.middleware.ts"],"names":[],"mappings":";;;AAOO,MAAM,YAAY,GAAG,CAAC,GAAa,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAQ,EAAE;IACnG,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC;IAEzC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE;QACtB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QAC1B,KAAK,EAAE;YACL,OAAO;YACP,UAAU;YACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAnBW,QAAA,YAAY,gBAmBvB;AAEK,MAAM,eAAe,GAAG,CAAC,GAAY,EAAE,GAAa,EAAQ,EAAE;IACnE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,KAAK,EAAE;YACL,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/proxy.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI1D,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,MAYlD,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,SAGxD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProxyMiddleware = void 0;
|
|
4
|
+
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
5
|
+
const url_parser_1 = require("../utils/url-parser");
|
|
6
|
+
const createProxyMiddleware = (agentServerUrl) => {
|
|
7
|
+
const parsedServerUrl = (0, url_parser_1.parseAgentServerUrl)(agentServerUrl);
|
|
8
|
+
const proxyOptions = {
|
|
9
|
+
target: parsedServerUrl.baseUrl,
|
|
10
|
+
changeOrigin: true,
|
|
11
|
+
pathRewrite: {
|
|
12
|
+
"^/api": "", // 将/api删除,转发到根路径
|
|
13
|
+
},
|
|
14
|
+
logLevel: "silent",
|
|
15
|
+
};
|
|
16
|
+
return (req, res, next) => {
|
|
17
|
+
return (0, http_proxy_middleware_1.createProxyMiddleware)(proxyOptions)(req, res, next);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.createProxyMiddleware = createProxyMiddleware;
|
|
21
|
+
//# sourceMappingURL=proxy.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.middleware.js","sourceRoot":"","sources":["../../src/middleware/proxy.middleware.ts"],"names":[],"mappings":";;;AACA,iEAAqF;AACrF,oDAA0D;AAEnD,MAAM,qBAAqB,GAAG,CAAC,cAAsB,EAAE,EAAE;IAC9D,MAAM,eAAe,GAAG,IAAA,gCAAmB,EAAC,cAAc,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAG;QACnB,MAAM,EAAE,eAAe,CAAC,OAAO;QAC/B,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE;YACX,OAAO,EAAE,EAAE,EAAE,iBAAiB;SAC/B;QACD,QAAQ,EAAE,QAAiB;KAC5B,CAAC;IAEF,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACzD,OAAO,IAAA,6CAAmB,EAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,qBAAqB,yBAehC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/upload.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAS5B;;GAEG;AACH,eAAO,MAAM,MAAM,eAKjB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,GAAiC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.uploadSingleFile = exports.upload = void 0;
|
|
7
|
+
const multer_1 = __importDefault(require("multer"));
|
|
8
|
+
/**
|
|
9
|
+
* Multer 配置 - 用于处理文件上传
|
|
10
|
+
* 使用内存存储,文件会被存储为 Buffer
|
|
11
|
+
*/
|
|
12
|
+
const bodyFileName = "file";
|
|
13
|
+
const storage = multer_1.default.memoryStorage();
|
|
14
|
+
/**
|
|
15
|
+
* 文件上传中间件配置
|
|
16
|
+
*/
|
|
17
|
+
exports.upload = (0, multer_1.default)({
|
|
18
|
+
storage,
|
|
19
|
+
limits: {
|
|
20
|
+
fileSize: 50 * 1024 * 1024, // 50MB 限制
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* 单文件上传中间件(字段名为 "openai-file",对齐 OpenAI 标准)
|
|
25
|
+
*/
|
|
26
|
+
exports.uploadSingleFile = exports.upload.single(bodyFileName);
|
|
27
|
+
//# sourceMappingURL=upload.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.middleware.js","sourceRoot":"","sources":["../../src/middleware/upload.middleware.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B;;;GAGG;AACH,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,OAAO,GAAG,gBAAM,CAAC,aAAa,EAAE,CAAC;AAEvC;;GAEG;AACU,QAAA,MAAM,GAAG,IAAA,gBAAM,EAAC;IAC3B,OAAO;IACP,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,UAAU;KACvC;CACF,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,gBAAgB,GAAQ,cAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/routes/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,eAAO,MAAM,iBAAiB,GAAI,WAAW,SAAS,+CAcrD,CAAC"}
|