interface ChatBotConstructorParams { AK: string, // api-key SK: string // secret-key } enum ChatRole { USER = 'user', ASSISTANT = 'assistant', FUNCTION = 'function' } interface ChatMessageBase { role: ChatRole content: string } interface FunctionCall { name: string arguments: string thoughts?: string } interface FunctionDefinition  { name: string description: string parameters: Record responses?: Record examples?: Array } type ChatBotConfigBase = Partial<{ stream: boolean temperature: number functions: Array top_p: number top_k: number penalty_score: number system: string user_id: string }> interface ChatParamsBase { messages: Array } interface ChatApiUsage { prompt_tokens: number //问题tokens数 completion_tokens: number //回答tokens数 total_tokens: number } interface ChatApiResponseBodyBase { id: string // 本轮对话的id object: string //回包类型 created: number // 时间戳 sentence_id?: number //表示当前子句的序号。只有在流式接口模式下会返回该字段 is_end?: boolean //表示当前子句是否是最后一句。只有在流式接口模式下会返回该字段 is_truncated: boolean //当前生成的结果是否被截断 result: string //对话返回结果 need_clear_history: boolean // 表示用户输入是否存在安全,是否关闭当前会话,清理历史会话信息 ban_round: number // 当need_clear_history为true时,此字段会告知第几轮对话有敏感信息,如果是当前问题,ban_round=-1 usage: ChatApiUsage //token统计信息,token数 = 汉字数+单词数*1.3 (仅为估算逻辑) } /** system: string user_id: string temperature: number top_p: number */ export { ChatRole, ChatParamsBase, ChatMessageBase, ChatBotConstructorParams, ChatBotConfigBase, FunctionCall, ChatApiResponseBodyBase }