mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-08-20 06:49:15 +08:00
fix: normalize line endings for consistent chunk splitting (#235)
This commit is contained in:
parent
4ddd659d8d
commit
eaaad27e44
@ -103,7 +103,8 @@ async function* chatReplayStream(
|
||||
const text = await fetchReplay(replayFilePath, {
|
||||
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) {
|
||||
const [eventRaw, dataRaw] = chunk.split("\n") as [string, string];
|
||||
const [, event] = eventRaw.split("event: ", 2) as [string, string];
|
||||
|
Loading…
x
Reference in New Issue
Block a user