Files
agent/app/types/types.ts
2025-10-16 21:24:18 +08:00

64 lines
820 B
TypeScript

/**
* 消息类型接口
*/
export interface Message {
/**
* 消息唯一标识符
*/
id: string;
/**
* 消息内容
*/
content: string;
/**
* 发送者类型
*/
sender: 'user' | 'bot';
/**
* 消息时间戳
*/
timestamp: Date;
}
/**
* Coze API 配置接口
*/
export interface CozeConfig {
/**
* Coze API 密钥
*/
apiKey: string;
/**
* Bot ID
*/
botId: string;
}
/**
* 聊天上下文接口
*/
export interface ChatContext {
/**
* 当前对话ID
*/
conversationId: string | null;
/**
* 历史消息列表
*/
messages: Message[];
/**
* 是否已初始化
*/
isInitialized: boolean;
}
/**
* 流式响应回调函数类型
*/
export type StreamCallback = (partialText: string, isDone: boolean) => void;