mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 04:14:46 +08:00
fix: normalize line endings for consistent chunk splitting (#235)
This commit is contained in:
@@ -103,7 +103,8 @@ async function* chatReplayStream(
|
|||||||
const text = await fetchReplay(replayFilePath, {
|
const text = await fetchReplay(replayFilePath, {
|
||||||
abortSignal: options.abortSignal,
|
abortSignal: options.abortSignal,
|
||||||
});
|
});
|
||||||
const chunks = text.split("\n\n");
|
const normalizedText = text.replace(/\r\n/g, "\n");
|
||||||
|
const chunks = normalizedText.split("\n\n");
|
||||||
for (const chunk of chunks) {
|
for (const chunk of chunks) {
|
||||||
const [eventRaw, dataRaw] = chunk.split("\n") as [string, string];
|
const [eventRaw, dataRaw] = chunk.split("\n") as [string, string];
|
||||||
const [, event] = eventRaw.split("event: ", 2) as [string, string];
|
const [, event] = eventRaw.split("event: ", 2) as [string, string];
|
||||||
|
|||||||
Reference in New Issue
Block a user