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 contentType = response.headers.get("content-type");
|
||||
if (contentType === "text/event-stream") {
|
||||
chatStore.streamMode = true;
|
||||
await _completeWithStreamMode(response);
|
||||
} else if (contentType === "application/json") {
|
||||
chatStore.streamMode = false;
|
||||
await _completeWithFetchMode(response);
|
||||
} else {
|
||||
throw `unknown response content type ${contentType}`;
|
||||
|
||||
Reference in New Issue
Block a user