fix(llm): storing >1 message in a chat note works

fix(llm): storing >1 message in a chat note works
This commit is contained in:
perf3ct
2025-06-03 03:12:09 +00:00
parent d4d55b20a8
commit 336cd1fbda
2 changed files with 27 additions and 37 deletions

View File

@@ -963,21 +963,10 @@ async function streamMessage(req: Request, res: Response) {
error: `Error processing message: ${error}`,
done: true
});
// Only write to the response if it hasn't been ended yet
if (!res.writableEnded) {
res.write(`data: ${JSON.stringify({ error: `Error processing message: ${error}`, done: true })}\n\n`);
res.end();
}
}
} catch (error: any) {
log.error(`Error starting message stream: ${error.message}`);
// Only write to the response if it hasn't been ended yet
if (!res.writableEnded) {
res.write(`data: ${JSON.stringify({ error: `Error starting message stream: ${error.message}`, done: true })}\n\n`);
res.end();
}
log.error(`Error starting message stream, can't communicate via WebSocket: ${error.message}`);
}
}