import { ChatBotBase } from '../chat-bot-base' import { ChatBotConfigBase, ChatApiResponseBodyBase, ChatMessageBase, FunctionCall, ChatBotConstructorParams } from '../chat-bot-base/types' export interface ERNIEBotChatMessage extends ChatMessageBase { name?: string, function_call?: FunctionCall } export interface ERNIEBotChatParams { content: string, name?: string } export interface ERNIEBotApiResponseBody extends ChatApiResponseBodyBase { function_call?: FunctionCall } export type ERNIEBotConfig = Partial> class ERNIEBot extends ChatBotBase { public constructor(params: ChatBotConstructorParams) { super(params) } protected getDefaultConfig(): ERNIEBotConfig { return { stream: false } } protected async getApiUrl(): Promise { const accessToken = await super.getAccessToken() return `https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions?access_token=${accessToken}`; } } export { ERNIEBot }