Commit 660868f8 authored by StyleZhang's avatar StyleZhang

Merge branch 'feat/chat-support-voice-input' into deploy/dev

parents e8685370 138bbfd9
......@@ -22,6 +22,16 @@ const baseOptions = {
redirect: 'follow',
}
const sseBaseOptions = {
method: 'GET',
mode: 'cors',
credentials: 'include', // always send cookies、HTTP Basic authentication.
headers: new Headers({
'Content-Type': ContentType.json,
}),
redirect: 'follow',
}
export type IOnDataMoreInfo = {
conversationId?: string
taskId?: string
......@@ -153,8 +163,14 @@ const baseFetch = (
options.headers.set('Authorization', `bearer ${sharedToken}`)
}
if (deleteContentType)
if (deleteContentType) {
options.headers.delete('Content-Type')
}
else {
const contentType = options.headers.get('Content-Type')
if (!contentType)
options.headers.set('Content-Type', ContentType.json)
}
const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
let urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}`
......@@ -295,7 +311,7 @@ export const upload = (options: any): Promise<any> => {
export const ssePost = (url: string, fetchOptions: any, { isPublicAPI = false, onData, onCompleted, onError, getAbortController }: IOtherOptions) => {
const abortController = new AbortController()
const options = Object.assign({}, baseOptions, {
const options = Object.assign({}, sseBaseOptions, {
method: 'POST',
signal: abortController.signal,
}, fetchOptions)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment