From 8949567d1a848f6abb6e93fd9e5a5e517c06e334 Mon Sep 17 00:00:00 2001 From: Harry-zklcdc Date: Tue, 23 Jan 2024 16:49:48 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=20=F0=9F=90=9B=20BingAPI=20ChatStream=20D?= =?UTF-8?q?ONE=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/chat.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/v1/chat.go b/api/v1/chat.go index 0f77860df2..51c624996b 100644 --- a/api/v1/chat.go +++ b/api/v1/chat.go @@ -118,6 +118,7 @@ func ChatHandler(w http.ResponseWriter, r *http.Request) { } w.Write([]byte("data: ")) w.Write(resData) + w.Write([]byte("\n")) break } resData, err := json.Marshal(resp) @@ -140,6 +141,8 @@ func ChatHandler(w http.ResponseWriter, r *http.Request) { }(globalChat.GetCookies()) } } + w.Write([]byte("data: [DONE]\n")) + flusher.Flush() } else { text, err := chat.Chat(prompt, msg) if err != nil {