From 91b1a36ac7f87eed187786a8547ce37c4c28cdd2 Mon Sep 17 00:00:00 2001 From: Sunner Sun Date: Wed, 13 Sep 2023 16:24:11 +0800 Subject: [PATCH] fix: ChatGPT never stop close #542 --- src/bots/openai/ChatGPTBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bots/openai/ChatGPTBot.js b/src/bots/openai/ChatGPTBot.js index 581829b6d6..57b1e4274e 100644 --- a/src/bots/openai/ChatGPTBot.js +++ b/src/bots/openai/ChatGPTBot.js @@ -200,7 +200,7 @@ export default class ChatGPTBot extends Bot { let preInfo = []; source.addEventListener("message", (event) => { const regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}$/; - if (event.data === "[DONE]") { + if (event.data.trim() === "[DONE]") { onUpdateResponse(callbackParam, { done: true }); source.close(); resolve();