|
@@ -1,11 +1,8 @@
|
|
|
-import fetchStream from 'fetch-readablestream'
|
|
|
import { API_PREFIX, IS_CE_EDITION, PUBLIC_API_PREFIX } from '@/config'
|
|
|
import Toast from '@/app/components/base/toast'
|
|
|
import type { MessageEnd, MessageReplace, ThoughtItem } from '@/app/components/app/chat/type'
|
|
|
-import { isSupportNativeFetchStream } from '@/utils/stream'
|
|
|
|
|
|
const TIME_OUT = 100000
|
|
|
-const supportNativeFetchStream = isSupportNativeFetchStream()
|
|
|
|
|
|
const ContentType = {
|
|
|
json: 'application/json',
|
|
@@ -223,9 +220,6 @@ const baseFetch = <T>(
|
|
|
if (body && bodyStringify)
|
|
|
options.body = JSON.stringify(body)
|
|
|
|
|
|
-
|
|
|
- const doFetch = supportNativeFetchStream ? globalThis.fetch : fetchStream
|
|
|
-
|
|
|
|
|
|
return Promise.race([
|
|
|
new Promise((resolve, reject) => {
|
|
@@ -234,7 +228,7 @@ const baseFetch = <T>(
|
|
|
}, TIME_OUT)
|
|
|
}),
|
|
|
new Promise((resolve, reject) => {
|
|
|
- doFetch(urlWithPrefix, options as RequestInit)
|
|
|
+ globalThis.fetch(urlWithPrefix, options as RequestInit)
|
|
|
.then((res) => {
|
|
|
const resClone = res.clone()
|
|
|
|