feat: add proxy support and fix streaming mode (#122)

This commit is contained in:
puppywang
2023-02-25 17:13:19 +08:00
committed by GitHub
parent cc91e95eed
commit 628187f5c3
7 changed files with 250 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
import type { GenericAbortSignal } from 'axios'
import type { AxiosProgressEvent, GenericAbortSignal } from 'axios'
import { post } from '@/utils/request'
export function fetchChatAPI<T = any>(
@@ -18,3 +18,19 @@ export function fetchChatConfig<T = any>() {
url: '/config',
})
}
/** 实验性质的函数,用于处理聊天过程中的中间结果 */
export function fetchChatAPIProcess<T = any>(
params: {
prompt: string
options?: { conversationId?: string; parentMessageId?: string }
signal?: GenericAbortSignal
onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void },
) {
return post<T>({
url: '/chat-process',
data: { prompt: params.prompt, options: params.options },
signal: params.signal,
onDownloadProgress: params.onDownloadProgress,
})
}