feat: 流式输出内容 (#93)

* feat: 流式输出内容

* fix: 修复异常状态

* feat: markdown 链接颜色
This commit is contained in:
Redon
2023-02-22 23:03:20 +08:00
committed by GitHub
parent ba83856173
commit 09359c3c46
7 changed files with 150 additions and 43 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>(
@@ -13,6 +13,21 @@ export function fetchChatAPI<T = any>(
})
}
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,
})
}
export function fetchChatConfig<T = any>() {
return post<T>({
url: '/config',