recognize text/event-stream, charset=utf-8

This commit is contained in:
2023-04-19 16:21:05 +08:00
parent 8f1a327ea0
commit b46b550a70

View File

@@ -182,7 +182,7 @@ export default function ChatBOX(props: {
setShowGenerating(true);
const response = await client._fetch(chatStore.streamMode);
const contentType = response.headers.get("content-type");
if (contentType === "text/event-stream") {
if (contentType?.startsWith("text/event-stream")) {
await _completeWithStreamMode(response);
} else if (contentType === "application/json") {
await _completeWithFetchMode(response);