From 384db42dcbedd97b5a9cce64e22bd0feb678a1cc Mon Sep 17 00:00:00 2001 From: czzonet Date: Tue, 10 Jan 2023 15:54:54 +0800 Subject: [PATCH] fix JSON parse error --- src/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index 163e83928..180d87b8a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -150,7 +150,13 @@ export async function browserPostEventStream( messageId }) } + try { + const checkJson = JSON.parse(data) + } catch (error) { + console.log('warning: parse error.') + return + } try { const convoResponseEvent: types.ConversationResponseEvent = JSON.parse(data)