From da31f32fcb37f08747d96a03c3d7d2aba84ea432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E5=A2=A8=E6=B0=B4=E9=B1=BC?= Date: Mon, 19 Jun 2023 20:11:09 +0800 Subject: [PATCH] Update chatbox.tsx handle "data:{xxxx}" --- src/chatbox.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 1c77d9e..1e69369 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -54,7 +54,7 @@ export default function ChatBOX(props: { .map((line) => line.trim()) .filter((i) => { if (!i) return false; - if (i === "data: [DONE]") { + if (i === "data: [DONE]" || i === "data:[DONE]") { responseDone = true; return false; } @@ -63,7 +63,7 @@ export default function ChatBOX(props: { console.log("lines", lines); const jsons: ChunkMessage[] = lines .map((line) => { - return JSON.parse(line.trim().slice("data: ".length)); + return JSON.parse(line.trim().slice("data:".length)); }) .filter((i) => i); console.log("jsons", jsons);