UNPKG

@ant-design/pro-chat

Version:
22 lines (21 loc) 819 B
import { ChatMessageError } from '../../types/message'; export declare const getMessageError: (response: Response) => Promise<ChatMessageError>; export type SSEFinishType = 'done' | 'error' | 'abort'; export type MixRequestResponse = Response | { content?: Response; [key: string]: any; } | string; export interface FetchSSEOptions { onErrorHandle?: (error: ChatMessageError) => void; onMessageHandle?: (text: string, response: MixRequestResponse) => void; onAbort?: (text: string) => Promise<void>; onFinish?: (type: SSEFinishType) => Promise<void>; onCancel?: () => void; signal?: AbortSignal; } /** * 使用流式方法获取数据 * @param fetchFn * @param options */ export declare const fetchSSE: (fetchFn: () => MixRequestResponse, options?: FetchSSEOptions) => Promise<any>;