1d58173178
- 新增扁平化路由:/dashboard, /assets, /titles, /voices, /templates, /generate, /history, /products, /subscription, /profile
- 新建 8 个功能页面,全部使用新 API(无 project_id)
- 新建 5 个 API 模块:assets, titles, voices, templates, products, dashboard
- Header 导航改造,支持手机端响应式(底部导航 + 抽屉菜单)
- 删除旧 workspace 页面和 API(ProjectAssets, ProjectGeneration 等)
- 修复路由懒加载类型(.then(m => ({ Component: m.default })))
- 修复 retryTask API 签名和 batchImportTitles 类型
- 全部页面中文注释,TypeScript 零错误
33 lines
860 B
TypeScript
33 lines
860 B
TypeScript
/**
|
|
* 任务相关 API
|
|
* Phase 1 重构:去掉 projectId,任务直接归属用户
|
|
*/
|
|
import apiClient from './client';
|
|
|
|
/** 任务条目 */
|
|
export interface TaskItem {
|
|
id: string;
|
|
task_type: 'ingest' | 'generation' | string;
|
|
status: string;
|
|
progress: number;
|
|
current_step: string;
|
|
error_message: string;
|
|
user_message: string;
|
|
retryable: boolean;
|
|
source_id: string;
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
}
|
|
|
|
/** 获取当前用户的所有任务(生成记录) */
|
|
export const getUserTasks = async (): Promise<TaskItem[]> => {
|
|
const response = await apiClient.get('/tasks');
|
|
return response.data.items || [];
|
|
};
|
|
|
|
/** 重试失败的任务 */
|
|
export const retryTask = async (taskId: string): Promise<TaskItem> => {
|
|
const response = await apiClient.post(`/tasks/${taskId}/retry`);
|
|
return response.data;
|
|
};
|