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); }