返回 AiToEarn
README.md
根目录 / project / aitoearn-web / src / api / ai / README.md
1 # ai API
2
3 ## 模块边界
4
5 AI 会话、Agent 任务、草稿生成与模型定价。
6
7 ## 文件清单
8
9 - `ai.api.ts`
10 - `ai.constants.ts`
11 - `ai.types.ts`
12
13 ## 接口清单
14
15 | 方法 | 请求 | 说明 |
16 | ------------------------------ | ----------------------------------------- | ---------------------------------------------------------------- |
17 | `agentApi.abortTask` | `POST agent/tasks/{param}/abort` | 中断内容生成任务 |
18 | `agentApi.createPublicShare` | `POST agent/tasks/{param}/share` | Create a public share token for a task |
19 | `agentApi.createRating` | `POST agent/tasks/{param}/rating` | 为任务创建或更新评分 |
20 | `agentApi.createTask` | `POST agent/tasks` | 创建AI生成任务(旧方法,保留兼容性) |
21 | `agentApi.createTaskWithSSE` | `前端封装` | 创建AI生成任务并通过 SSE 接收实时消息 |
22 | `agentApi.deleteTask` | `DELETE agent/tasks/{param}` | 删除任务 |
23 | `agentApi.favoriteTask` | `POST agent/tasks/{param}/favorite` | 收藏任务 |
24 | `agentApi.getTaskByShareToken` | `GET agent/tasks/shared/{param}` | Get task by public share token (no authentication required) |
25 | `agentApi.getTaskDetail` | `GET agent/tasks/{param}` | 获取任务详情 |
26 | `agentApi.getTaskList` | `GET agent/tasks` | 获取任务列表 |
27 | `agentApi.getTaskMessages` | `GET agent/tasks/{param}/messages` | 获取任务消息(增量) |
28 | `agentApi.getTaskRating` | `GET agent/tasks/{param}/rating` | 获取任务评分 |
29 | `agentApi.stopTask` | `DELETE agent/tasks/{param}` | 停止/取消任务 |
30 | `agentApi.submitTaskRating` | `POST agent/tasks/{param}/rating` | 提交或更新任务评分 |
31 | `agentApi.unfavoriteTask` | `DELETE agent/tasks/{param}/favorite` | 取消收藏任务 |
32 | `agentApi.updateTaskTitle` | `PATCH agent/tasks/{param}` | 更新任务标题 |
33 | `aiChatStream` | `前端封装` | AI聊天接口 - 支持流式和非流式响应 |
34 | `apiCreateDraftFromVideoUrl` | `POST ai/draft-generation/from-video-url` | 根据视频 URL 生成草稿 |
35 | `apiCreateDraftGeneration` | `POST ai/draft-generation/v2` | 创建 AI 批量生成草稿任务 |
36 | `apiCreateImageTextDraft` | `POST ai/draft-generation/image-text` | 创建 AI 图文草稿生成任务 |
37 | `apiGetDraftGenerationList` | `GET ai/draft-generation` | 获取生成任务列表(分页) |
38 | `apiGetDraftGenerationPricing` | `GET ai/draft-generation/pricing` | 获取图片模型定价信息 |
39 | `apiGetDraftGenerationStats` | `GET ai/draft-generation/stats` | 获取生成中任务数量统计(轮询用,静默模式不弹错误提示) |
40 | `apiQueryDraftGenerationTasks` | `POST ai/draft-generation/query` | 根据任务 ID 批量查询生成任务状态(轮询用,静默模式不弹错误提示) |
41 | `getAgentAssets` | `GET ai/assets` | 获取 Agent 生成的素材列表 |
42 | `getChatModels` | `GET ai/models/chat` | Get Chat Model Parameters |
43 | `getLogs` | `GET ai/logs` | 获取用户 AI 活动日志 |
44 | `getVideoGenerations` | `GET ai/video/generations` | List Video Tasks |
45
46 ## 类型清单
47
48 | 名称 | 类型 | 说明 |
49 | -------------------------------------- | ----------- | ------------------------------------- |
50 | `AdaptPlatform` | `type` | AdaptPlatform 类型。 |
51 | `AgentTaskRatingData` | `interface` | Agent 任务评分数据。 |
52 | `AgentTaskRatingResponse` | `interface` | Agent 任务评分响应。 |
53 | `AgentTaskShareVo` | `interface` | Agent 任务公开分享响应。 |
54 | `AiChatMessage` | `interface` | AI 聊天消息。 |
55 | `AiChatStreamParams` | `interface` | AI 聊天请求参数。 |
56 | `AiLogListParams` | `interface` | AI 日志查询参数。 |
57 | `AiPaginationParams` | `interface` | AI 分页查询参数。 |
58 | `ChatModel` | `interface` | ChatModel 类型。 |
59 | `ChatModelFixedImagePricing` | `interface` | ChatModelFixedImagePricing 类型。 |
60 | `ChatModelPricing` | `interface` | ChatModelPricing 类型。 |
61 | `ChatModelPricingTier` | `interface` | ChatModelPricingTier 类型。 |
62 | `CreateAgentTaskParams` | `interface` | CreateAgentTaskParams 请求参数。 |
63 | `CreateDraftFromVideoUrlDto` | `interface` | CreateDraftFromVideoUrlDto 请求参数。 |
64 | `CreateDraftFromVideoUrlVo` | `interface` | CreateDraftFromVideoUrlVo 响应数据。 |
65 | `CreateDraftGenerationVo` | `interface` | CreateDraftGenerationVo 响应数据。 |
66 | `CreateImageTextDraftGenerationParams` | `interface` | AI 图文草稿批量生成请求参数。 |
67 | `CreateTaskResponse` | `interface` | CreateTaskResponse 响应数据。 |
68 | `CreateVideoDraftGenerationParams` | `interface` | AI 视频草稿批量生成请求参数。 |
69 | `DraftContentType` | `type` | DraftContentType 类型。 |
70 | `DraftGenerationPricingVo` | `interface` | DraftGenerationPricingVo 响应数据。 |
71 | `DraftGenerationQueue` | `interface` | DraftGenerationQueue 类型。 |
72 | `DraftGenerationRequest` | `interface` | DraftGenerationRequest 请求参数。 |
73 | `DraftGenerationResponse` | `interface` | DraftGenerationResponse 响应数据。 |
74 | `DraftGenerationStats` | `interface` | DraftGenerationStats 数据结构。 |
75 | `DraftGenerationTask` | `interface` | DraftGenerationTask 类型。 |
76 | `DraftGenerationTaskListVo` | `interface` | DraftGenerationTaskListVo 响应数据。 |
77 | `DraftTaskStatus` | `type` | 草稿生成任务状态。 |
78 | `GetTaskListParams` | `interface` | GetTaskListParams 请求参数。 |
79 | `ImageModelInfo` | `interface` | ImageModelInfo 数据结构。 |
80 | `ImageModelPricing` | `interface` | ImageModelPricing 类型。 |
81 | `ImageModelType` | `type` | ImageModelType 类型。 |
82 | `ImageTextDraftType` | `type` | ImageTextDraftType 类型。 |
83 | `Media` | `interface` | Media 类型。 |
84 | `Platform` | `type` | Platform 类型。 |
85 | `ResultAction` | `type` | ResultAction 类型。 |
86 | `ResultData` | `interface` | ResultData 数据结构。 |
87 | `ResultMessage` | `interface` | ResultMessage 类型。 |
88 | `ResultType` | `type` | ResultType 类型。 |
89 | `SSEMessage` | `interface` | SSEMessage 类型。 |
90 | `StreamEvent` | `interface` | StreamEvent 类型。 |
91 | `SubmitAgentTaskRatingPayload` | `interface` | 提交 Agent 任务评分请求参数。 |
92 | `TaskDetail` | `interface` | TaskDetail 数据结构。 |
93 | `TaskListItem` | `interface` | TaskListItem 数据结构。 |
94 | `TaskListResponse` | `interface` | TaskListResponse 响应数据。 |
95 | `TaskMessage` | `interface` | TaskMessage 类型。 |
96 | `TaskMessagesVo` | `interface` | TaskMessagesVo 响应数据。 |
97 | `VideoDraftType` | `type` | VideoDraftType 类型。 |
98 | `VideoGenerationHistoryItem` | `interface` | 视频生成历史记录项。 |
99 | `VideoGenerationHistoryListVo` | `interface` | 视频生成历史列表响应数据。 |
100 | `VideoGenerationTimestamp` | `type` | 视频生成历史时间戳。 |
101 | `VideoModelInfo` | `interface` | VideoModelInfo 数据结构。 |
102 | `VideoModelInputConstraint` | `interface` | VideoModelInputConstraint 类型。 |
103 | `VideoModelInputConstraints` | `interface` | VideoModelInputConstraints 类型。 |
104 | `VideoModelPricing` | `interface` | VideoModelPricing 类型。 |
105 | `VideoModelType` | `type` | 视频生成模型类型标识。 |
106
107 ## 常量清单
108
109 | 名称 | 类型 | 说明 |
110 | ----------------- | ------ | ---------------------- |
111 | `AgentTaskStatus` | `enum` | AgentTaskStatus 枚举。 |
112 | `MediaType` | `enum` | MediaType 枚举。 |
113
113 lines MARKDOWN