Skip to content

Commit

Permalink
[Fix] 🐛 BingAPI ChatStream DONE flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-zklcdc committed Jan 23, 2024
1 parent e7f243d commit 8949567
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 8949567

Please # to comment.