From 8a86334d0564f59cf7b2f18118a1c277c3263f18 Mon Sep 17 00:00:00 2001 From: TradeMate Dev Date: Tue, 23 Jun 2026 23:21:28 +0800 Subject: [PATCH] fix: sandbox non-stream response not sent due to @Res() express native mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sandbox.controller.ts: non-stream chat path now calls res.json() instead of returning the value (which NestJS discards in @Res() library mode) - ai-gateway.service.ts: 商汤科技 only registers sensenova model, no longer overwrites deepseek registration - .gitignore: add .playwright-mcp/ and gitea-login.png --- .gitignore | 2 ++ backend/src/modules/ai/ai-gateway.service.ts | 21 +++++++++---------- .../src/modules/sandbox/sandbox.controller.ts | 3 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index db4e4cd..c3ba762 100755 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ out/ # Environment files .env .env.local +.playwright-mcp/ +gitea-login.png .env.*.local backend/.env frontend/.env.local diff --git a/backend/src/modules/ai/ai-gateway.service.ts b/backend/src/modules/ai/ai-gateway.service.ts index e58f350..8322260 100755 --- a/backend/src/modules/ai/ai-gateway.service.ts +++ b/backend/src/modules/ai/ai-gateway.service.ts @@ -69,17 +69,16 @@ export class AIGatewayService { if (!apiUrl.endsWith('/chat/completions')) { apiUrl = apiUrl.replace(/\/+$/, '') + '/chat/completions'; } - const models = ['deepseek-v4-flash', 'sensenova-6.7-flash-lite']; - for (const modelName of models) { - this.providers.set(modelName, new OpenAICompatibleProvider( - process.env.SENSENOVA_API_KEY!, - apiUrl, - modelName, - '商汤科技', - )); - this.markAvailable(modelName); - } - this.logger.log(`商汤科技已注册: ${models.join(', ')}`); + // 商汤科技仅注册 sensenova 自有模型,避免覆盖硅基流动的 deepseek 注册 + const modelName = 'sensenova-6.7-flash-lite'; + this.providers.set(modelName, new OpenAICompatibleProvider( + process.env.SENSENOVA_API_KEY!, + apiUrl, + modelName, + '商汤科技', + )); + this.markAvailable(modelName); + this.logger.log(`商汤科技已注册: ${modelName}`); } } diff --git a/backend/src/modules/sandbox/sandbox.controller.ts b/backend/src/modules/sandbox/sandbox.controller.ts index 516c101..06049ee 100755 --- a/backend/src/modules/sandbox/sandbox.controller.ts +++ b/backend/src/modules/sandbox/sandbox.controller.ts @@ -35,7 +35,8 @@ export class SandboxController { } res.end(); } else { - return this.sandboxService.chat(req.user.userId, body.conversationId, body.model, body.messages, body, body.images); + const result = await this.sandboxService.chat(req.user.userId, body.conversationId, body.model, body.messages, body, body.images); + res.json(result); } }