feat: improve embedding sys.user_id and conversion id info usage (#18035)
This commit is contained in:
@@ -287,9 +287,9 @@ const handleStream = (
|
||||
|
||||
const baseFetch = base
|
||||
|
||||
export const upload = (options: any, isPublicAPI?: boolean, url?: string, searchParams?: string): Promise<any> => {
|
||||
export const upload = async (options: any, isPublicAPI?: boolean, url?: string, searchParams?: string): Promise<any> => {
|
||||
const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
|
||||
const token = getAccessToken(isPublicAPI)
|
||||
const token = await getAccessToken(isPublicAPI)
|
||||
const defaultOptions = {
|
||||
method: 'POST',
|
||||
url: (url ? `${urlPrefix}${url}` : `${urlPrefix}/files/upload`) + (searchParams || ''),
|
||||
@@ -324,7 +324,7 @@ export const upload = (options: any, isPublicAPI?: boolean, url?: string, search
|
||||
})
|
||||
}
|
||||
|
||||
export const ssePost = (
|
||||
export const ssePost = async (
|
||||
url: string,
|
||||
fetchOptions: FetchOptionType,
|
||||
otherOptions: IOtherOptions,
|
||||
@@ -385,7 +385,7 @@ export const ssePost = (
|
||||
if (body)
|
||||
options.body = JSON.stringify(body)
|
||||
|
||||
const accessToken = getAccessToken(isPublicAPI)
|
||||
const accessToken = await getAccessToken(isPublicAPI)
|
||||
; (options.headers as Headers).set('Authorization', `Bearer ${accessToken}`)
|
||||
|
||||
globalThis.fetch(urlWithPrefix, options as RequestInit)
|
||||
|
||||
Reference in New Issue
Block a user