fe49fef1ad
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 55s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m12s
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
CI/CD Pipeline / CI Gate (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
- Step2/Step4 auto-save via useDraftAutoSave (GET-merge-PUT, serial queue)
- useDraftAutoSave: failed saves preserve patch with exponential backoff retry
- Step6 cover requests include full title_config
- Step7 create task: source_edit_plan_id, title_config, cover_url priority
- Polling switched to GET /generation/tasks/{task_id} with proper error handling
- getGenerationTaskResults retries before treating as failure
- Removed 7 ghost API functions (non-existent backend routes)
- BGM presets path updated to /templates/{id}/editor/bgm/presets
- Type alignment for BatchGenerationTaskResponse
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
/**
|
||
* 任务相关 API 函数
|
||
* 对接后端任务中心 API
|
||
*/
|
||
import apiClient from "../client"
|
||
import type {
|
||
CreateGenerationTaskRequest,
|
||
CreateGenerationTaskResponse,
|
||
GenerationTaskDetail,
|
||
TaskItem,
|
||
TaskListParams,
|
||
TaskListResponse,
|
||
} from "./types"
|
||
|
||
/** 创建生成任务(智能剪辑) */
|
||
export const createGenerationTask = async (
|
||
params: CreateGenerationTaskRequest,
|
||
): Promise<CreateGenerationTaskResponse> => {
|
||
const { data } = await apiClient.post<CreateGenerationTaskResponse>("/generation/tasks", params)
|
||
return data
|
||
}
|
||
|
||
/** 获取单个生成任务详情(轮询用) */
|
||
export const getGenerationTask = async (taskId: string): Promise<GenerationTaskDetail> => {
|
||
const { data } = await apiClient.get<GenerationTaskDetail>(`/generation/tasks/${taskId}`)
|
||
return data
|
||
}
|
||
|
||
/** 获取任务列表(支持分页和筛选) */
|
||
export const getTasks = async (params?: TaskListParams): Promise<TaskListResponse> => {
|
||
const { data } = await apiClient.get<TaskListResponse>("/tasks", {
|
||
params,
|
||
})
|
||
return data
|
||
}
|
||
|
||
/** 获取当前用户的所有任务(兼容旧接口,跨 project) */
|
||
export const getUserTasks = async (): Promise<TaskItem[]> => {
|
||
const { data } = await apiClient.get("/tasks")
|
||
return data.items || data || []
|
||
}
|
||
|
||
/** 获取单个任务详情(含 error_info) */
|
||
export const getTask = async (taskId: string): Promise<TaskItem> => {
|
||
const { data } = await apiClient.get(`/tasks/${taskId}`)
|
||
return data
|
||
}
|
||
|
||
/** 重试失败的任务 */
|
||
export const retryTask = async (taskId: string): Promise<TaskItem> => {
|
||
const { data } = await apiClient.post(`/tasks/${taskId}/retry`)
|
||
return data
|
||
}
|