update stream mode based on response
This commit is contained in:
@@ -109,8 +109,10 @@ export default function ChatBOX(props: {
|
|||||||
const response = await client._fetch(chatStore.streamMode);
|
const response = await client._fetch(chatStore.streamMode);
|
||||||
const contentType = response.headers.get("content-type");
|
const contentType = response.headers.get("content-type");
|
||||||
if (contentType === "text/event-stream") {
|
if (contentType === "text/event-stream") {
|
||||||
|
chatStore.streamMode = true;
|
||||||
await _completeWithStreamMode(response);
|
await _completeWithStreamMode(response);
|
||||||
} else if (contentType === "application/json") {
|
} else if (contentType === "application/json") {
|
||||||
|
chatStore.streamMode = false;
|
||||||
await _completeWithFetchMode(response);
|
await _completeWithFetchMode(response);
|
||||||
} else {
|
} else {
|
||||||
throw `unknown response content type ${contentType}`;
|
throw `unknown response content type ${contentType}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user