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
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
/**
|
|
* 模板草稿 CRUD + 生成相关 API
|
|
*/
|
|
import apiClient from "../client"
|
|
import type {
|
|
EditPlan,
|
|
UpdateEditPlanRequest,
|
|
GenerateResponse,
|
|
GenerationStatusResponse,
|
|
EditPlanGeneration,
|
|
GeneratedVideo,
|
|
} from "./types"
|
|
|
|
/** 获取单个模板草稿 */
|
|
export async function getEditPlan(templateId: string): Promise<EditPlan> {
|
|
const response = await apiClient.get(`/templates/${templateId}/editor`)
|
|
return response.data
|
|
}
|
|
|
|
/** 更新模板草稿(支持传入 AbortSignal 用于自动保存竞态取消) */
|
|
export async function updateEditPlan(
|
|
templateId: string,
|
|
data: UpdateEditPlanRequest,
|
|
signal?: AbortSignal,
|
|
): Promise<EditPlan> {
|
|
const response = await apiClient.put(`/templates/${templateId}/editor`, data, { signal })
|
|
return response.data
|
|
}
|
|
|
|
/** 触发生成 */
|
|
export async function generateEditPlan(templateId: string): Promise<GenerateResponse> {
|
|
const response = await apiClient.post(`/templates/${templateId}/editor/generate`)
|
|
return response.data
|
|
}
|
|
|
|
/** 获取生成状态(轮询用) */
|
|
export async function getGenerationStatus(templateId: string): Promise<GenerationStatusResponse> {
|
|
const response = await apiClient.get(`/templates/${templateId}/editor/generation-status`)
|
|
return response.data
|
|
}
|
|
|
|
/** 获取模板草稿关联的生成记录 */
|
|
export async function getEditPlanGenerations(templateId: string): Promise<EditPlanGeneration[]> {
|
|
const response = await apiClient.get(`/templates/${templateId}/editor/generations`)
|
|
return response.data.items || []
|
|
}
|
|
|
|
/** 获取生成任务的视频结果列表 */
|
|
export async function getGenerationTaskResults(taskId: string): Promise<GeneratedVideo[]> {
|
|
const response = await apiClient.get(`/generation/tasks/${taskId}/results`)
|
|
return response.data.items || response.data || []
|
|
}
|