fix: OpenAI Fetch API (#15)

This commit is contained in:
Eric Tuvesson
2024-05-09 14:17:08 +02:00
committed by GitHub
parent c7053f6ddf
commit 68e2070c61

View File

@@ -38,7 +38,7 @@ async function directChatOpenAi({ messages, provider, abortController, onEnd, on
stream: true
}),
async onopen(response) {
if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
if (response.ok && response.headers.get('content-type').includes(EventStreamContentType)) {
return; // everything's good
} else if (response.status >= 400 && response.status < 500 && response.status !== 429) {
// client-side errors are usually non-retriable: