对话、重新生成、评价完成

This commit is contained in:
2025-11-05 16:55:58 +08:00
parent 8850a06fea
commit d9d62e22de
34 changed files with 1658 additions and 965 deletions

View File

@@ -321,6 +321,10 @@ export interface KnowledgePermissionParams {
* Streaming 回调接口
*/
export interface StreamCallback {
/** 开始连接 */
onStart?: (eventSource: EventSource) => void;
/** 初始化数据包含messageId用于停止生成 */
onInit?: (initData: { messageId: string; conversationId: string }) => void;
/** 接收到消息片段 */
onMessage?: (message: string) => void;
/** 消息结束 */
@@ -329,6 +333,28 @@ export interface StreamCallback {
onComplete?: () => void;
/** 错误 */
onError?: (error: Error) => void;
/** Dify原始事件回调包含task_id等完整信息 */
onDifyEvent?: (eventType: string, eventData: any) => void;
}
/**
* Dify事件数据接口
*/
export interface DifyEvent {
/** 事件类型 */
event: string;
/** 任务ID */
task_id?: string;
/** 工作流运行ID */
workflow_run_id?: string;
/** 消息ID */
message_id?: string;
/** 会话ID */
conversation_id?: string;
/** 创建时间戳 */
created_at?: number;
/** 其他字段 */
[key: string]: any;
}
// ==================== Dify 文档分段相关类型 ====================