126 lines
2.5 KiB
TypeScript
126 lines
2.5 KiB
TypeScript
/**
|
|
* Dify API 模块统一导出
|
|
*
|
|
* 提供 Dify 相关功能的统一入口
|
|
*
|
|
* @module api/dify
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* // 客户端使用
|
|
* import { sendChatMessage, fetchConversations } from '~/api/dify';
|
|
*
|
|
* // 使用 SSE 处理器
|
|
* import { handleSSEStream, SSEStreamHandler } from '~/api/dify';
|
|
*
|
|
* // 使用类型
|
|
* import type { ChatItem, ConversationItem, SSECallbacks } from '~/api/dify';
|
|
* ```
|
|
*/
|
|
|
|
// ============================================================================
|
|
// 类型导出
|
|
// ============================================================================
|
|
|
|
export type {
|
|
// 基础类型
|
|
AppInfo,
|
|
ConversationItem,
|
|
ChatItem,
|
|
MessageMore,
|
|
Feedbacktype,
|
|
ThoughtItem,
|
|
RetrieverResource,
|
|
|
|
// 文件类型
|
|
VisionFile,
|
|
ImageFile,
|
|
VisionSettings,
|
|
|
|
// 表单类型
|
|
TextTypeFormItem,
|
|
SelectTypeFormItem,
|
|
UserInputFormItem,
|
|
PromptConfig,
|
|
PromptVariable,
|
|
|
|
// 工作流类型
|
|
NodeTracing,
|
|
WorkflowProcess,
|
|
|
|
// SSE 事件类型
|
|
MessageEvent,
|
|
MessageReplace,
|
|
MessageEnd,
|
|
WorkflowStartedResponse,
|
|
WorkflowFinishedResponse,
|
|
NodeStartedResponse,
|
|
NodeFinishedResponse,
|
|
|
|
// SSE 回调类型
|
|
OnDataMoreInfo,
|
|
OnData,
|
|
OnThought,
|
|
OnFile,
|
|
OnMessageEnd,
|
|
OnMessageReplace,
|
|
OnCompleted,
|
|
OnError,
|
|
OnWorkflowStarted,
|
|
OnWorkflowFinished,
|
|
OnNodeStarted,
|
|
OnNodeFinished,
|
|
SSECallbacks,
|
|
|
|
// API 请求/响应类型
|
|
SendMessageParams,
|
|
ConversationsResponse,
|
|
MessagesResponse,
|
|
AppParametersResponse,
|
|
} from './types';
|
|
|
|
export {
|
|
// 枚举
|
|
Resolution,
|
|
TransferMethod,
|
|
WorkflowRunningStatus,
|
|
NodeRunningStatus,
|
|
BlockEnum,
|
|
CodeLanguage,
|
|
} from './types';
|
|
|
|
// ============================================================================
|
|
// SSE 处理器导出
|
|
// ============================================================================
|
|
|
|
export {
|
|
SSEStreamHandler,
|
|
SSEEventType,
|
|
handleSSEStream,
|
|
handleStream,
|
|
createSSECallbacks,
|
|
} from './sse-handler';
|
|
|
|
// ============================================================================
|
|
// 客户端 API 导出
|
|
// ============================================================================
|
|
|
|
export {
|
|
// 会话管理
|
|
fetchConversations,
|
|
fetchChatList,
|
|
renameConversation,
|
|
generateConversationName,
|
|
deleteConversation,
|
|
|
|
// 应用参数
|
|
fetchAppParams,
|
|
|
|
// 消息
|
|
sendChatMessage,
|
|
updateFeedback,
|
|
|
|
// 文件上传
|
|
uploadFile,
|
|
} from './client';
|