fix: don't kill stream after approval — only abort on stop
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 37s

This commit is contained in:
WangDL 2026-05-22 19:18:27 +08:00
parent e6ecb2c48f
commit 25d25b44f0

View File

@ -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 {
// 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 {}
}).catch(() => {});
return { success: true };
}
// Stop: abort the stream
return this.aiChatService.stopRun(body.runId);
}