From 25d25b44f0f5f9d6b238f146cacb6b742ea77226 Mon Sep 17 00:00:00 2001 From: WangDL Date: Fri, 22 May 2026 19:18:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20don't=20kill=20stream=20after=20approval?= =?UTF-8?q?=20=E2=80=94=20only=20abort=20on=20stop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin-ai-chat/admin-ai-chat.controller.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/admin-ai-chat/admin-ai-chat.controller.ts b/src/modules/admin-ai-chat/admin-ai-chat.controller.ts index 9e31075..0f8e186 100644 --- a/src/modules/admin-ai-chat/admin-ai-chat.controller.ts +++ b/src/modules/admin-ai-chat/admin-ai-chat.controller.ts @@ -36,15 +36,15 @@ export class AdminAiChatController { @ApiOperation({ summary: '停止正在运行的 AI 任务' }) async stopChat(@Body() body: { runId: string; action?: string }) { if (body.action) { - // Approval action: forward to Hermes - try { - await fetch(`http://10.2.0.7:8642/v1/runs/${body.runId}/approval`, { - method: 'POST', - headers: { 'Content-Type': 'application/json', Authorization: 'Bearer zhixi-hermes-key-2026' }, - body: JSON.stringify({ choice: body.action }), - }); - } catch {} + // Approval: just forward to Hermes, don't kill the stream + await fetch(`http://10.2.0.7:8642/v1/runs/${body.runId}/approval`, { + method: 'POST', + headers: { 'Content-Type': 'application/json', Authorization: 'Bearer zhixi-hermes-key-2026' }, + body: JSON.stringify({ choice: body.action }), + }).catch(() => {}); + return { success: true }; } + // Stop: abort the stream return this.aiChatService.stopRun(body.runId); }