/** * 编辑计划 API */ import apiClient from "./client"; export type EditingMode = "one-take" | "pip" | "voiceover" | "voice_pip"; export interface EditTemplateItem { id: string; project_id: string; name: string; description: string; target_duration: number; clip_count: number; is_active: boolean; } export interface EditPlanClipItem { id: string; asset_id: string; asset_name: string; sequence: number; start_time: number; duration: number; reason: string; layer?: "main" | "pip" | "broll"; thumbnail_url?: string; } export interface EditPlanItem { id: string; project_id: string; template_id: string; asset_library_id: string; title_id: string; status: string; editing_mode?: EditingMode; summary: string; clips: EditPlanClipItem[]; created_at?: string; updated_at?: string; } export const getEditTemplates = async (projectId: string): Promise => { const response = await apiClient.get(`/projects/${projectId}/edit-plans/templates`, ); return response.data; }; export const createEditPlan = async ({ projectId, data }: { projectId: string; data: { asset_library_id: string; template_id?: string; title_id?: string; } }): Promise => { const response = await apiClient.post(`/projects/${projectId}/edit-plans`, data); return response.data; }; /** * 获取编排计划列表 */ export const getEditPlans = async (projectId: string): Promise => { const response = await apiClient.get(`/projects/${projectId}/edit-plans/`); return response.data.items || []; }; /** * 获取单个编排计划 */ export const getEditPlan = async (projectId: string, planId: string): Promise => { const response = await apiClient.get(`/projects/${projectId}/edit-plans/${planId}`); return response.data; }; /** * 智能编排 - 自动生成编辑计划 */ export const autoGenerateEditPlan = async (projectId: string, params: { editing_mode: EditingMode; target_duration?: number; }): Promise => { const response = await apiClient.post(`/projects/${projectId}/edit-plans/auto-generate/`, params); return response.data; }; /** * 删除编辑计划 */ export const deleteEditPlan = async (projectId: string, planId: string): Promise => { await apiClient.delete(`/projects/${projectId}/edit-plans/${planId}`); }; /** * 更新编辑计划 */ export const updateEditPlan = async (projectId: string, planId: string, data: Partial): Promise => { const response = await apiClient.patch(`/projects/${projectId}/edit-plans/${planId}`, data); return response.data; };