feat(phase2): 剪辑计划API路径从/edit-plans迁移到/template-editors #645
Regular → Executable
+32
-22
@@ -189,6 +189,7 @@ export interface ClipStatusItem {
|
||||
asset_id?: string
|
||||
text_content?: string
|
||||
duration?: number
|
||||
error_message?: string
|
||||
}
|
||||
|
||||
/** 生成状态轮询响应 */
|
||||
@@ -197,6 +198,9 @@ export interface GenerationStatusResponse {
|
||||
plan_status: EditPlanStatus
|
||||
generation_task_id?: string
|
||||
clips: ClipStatusItem[]
|
||||
error_message?: string
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
/** 生成视频详情(对应后端 GeneratedVideoResponse) */
|
||||
@@ -341,7 +345,7 @@ export interface EditPlanListResponse {
|
||||
|
||||
/** 获取模板草稿列表(支持分页和筛选) */
|
||||
export async function getEditPlans(params?: EditPlanListParams): Promise<EditPlanListResponse> {
|
||||
const response = await apiClient.get<EditPlanListResponse>("/edit-plans", {
|
||||
const response = await apiClient.get<EditPlanListResponse>("/template-editors", {
|
||||
params,
|
||||
})
|
||||
return response.data
|
||||
@@ -349,13 +353,13 @@ export async function getEditPlans(params?: EditPlanListParams): Promise<EditPla
|
||||
|
||||
/** 获取单个模板草稿 */
|
||||
export async function getEditPlan(planId: string): Promise<EditPlan> {
|
||||
const response = await apiClient.get(`/edit-plans/${planId}`)
|
||||
const response = await apiClient.get(`/template-editors/${planId}`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 创建模板草稿 */
|
||||
export async function createEditPlan(data: CreateEditPlanRequest): Promise<EditPlan> {
|
||||
const response = await apiClient.post("/edit-plans", data)
|
||||
const response = await apiClient.post("/template-editors", data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -364,24 +368,24 @@ export async function updateEditPlan(
|
||||
planId: string,
|
||||
data: UpdateEditPlanRequest,
|
||||
): Promise<EditPlan> {
|
||||
const response = await apiClient.put(`/edit-plans/${planId}`, data)
|
||||
const response = await apiClient.put(`/template-editors/${planId}`, data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 删除模板草稿 */
|
||||
export async function deleteEditPlan(planId: string): Promise<void> {
|
||||
await apiClient.delete(`/edit-plans/${planId}`)
|
||||
await apiClient.delete(`/template-editors/${planId}`)
|
||||
}
|
||||
|
||||
/** 触发生成 */
|
||||
export async function generateEditPlan(planId: string): Promise<GenerateResponse> {
|
||||
const response = await apiClient.post(`/edit-plans/${planId}/generate`)
|
||||
const response = await apiClient.post(`/template-editors/${planId}/generate`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 获取生成状态(轮询用) */
|
||||
export async function getGenerationStatus(planId: string): Promise<GenerationStatusResponse> {
|
||||
const response = await apiClient.get(`/edit-plans/${planId}/generation-status`)
|
||||
const response = await apiClient.get(`/template-editors/${planId}/generation-status`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -390,7 +394,7 @@ export async function aiRecommendClips(
|
||||
planId: string,
|
||||
data: AIRecommendRequest,
|
||||
): Promise<AIRecommendResponse> {
|
||||
const response = await apiClient.post(`/edit-plans/${planId}/ai-recommend`, data)
|
||||
const response = await apiClient.post(`/template-editors/${planId}/ai-recommend`, data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -399,13 +403,13 @@ export async function generateCover(
|
||||
planId: string,
|
||||
data: GenerateCoverRequest,
|
||||
): Promise<GenerateCoverResponse> {
|
||||
const response = await apiClient.post(`/edit-plans/${planId}/generate-cover`, data)
|
||||
const response = await apiClient.post(`/template-editors/${planId}/generate-cover`, data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 获取模板草稿关联的生成记录 */
|
||||
export async function getEditPlanGenerations(planId: string): Promise<EditPlanGeneration[]> {
|
||||
const response = await apiClient.get(`/edit-plans/${planId}/generations`)
|
||||
const response = await apiClient.get(`/template-editors/${planId}/generations`)
|
||||
return response.data.items || []
|
||||
}
|
||||
|
||||
@@ -417,7 +421,7 @@ export async function getGenerationTaskResults(taskId: string): Promise<Generate
|
||||
|
||||
/** 取消生成任务 */
|
||||
export async function cancelGeneration(planId: string): Promise<void> {
|
||||
await apiClient.post(`/edit-plans/${planId}/cancel`)
|
||||
await apiClient.post(`/template-editors/${planId}/cancel`)
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
@@ -492,15 +496,18 @@ export async function getEditPlanClips(
|
||||
planId: string,
|
||||
params?: EditPlanClipListParams,
|
||||
): Promise<EditPlanClipListResponse> {
|
||||
const response = await apiClient.get<EditPlanClipListResponse>(`/edit-plans/${planId}/clips`, {
|
||||
params,
|
||||
})
|
||||
const response = await apiClient.get<EditPlanClipListResponse>(
|
||||
`/template-editors/${planId}/clips`,
|
||||
{
|
||||
params,
|
||||
},
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 获取单个片段详情 */
|
||||
export async function getEditPlanClip(planId: string, clipId: string): Promise<EditPlanClip> {
|
||||
const response = await apiClient.get<EditPlanClip>(`/edit-plans/${planId}/clips/${clipId}`)
|
||||
const response = await apiClient.get<EditPlanClip>(`/template-editors/${planId}/clips/${clipId}`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -509,7 +516,7 @@ export async function createEditPlanClip(
|
||||
planId: string,
|
||||
data: CreateEditPlanClipRequest,
|
||||
): Promise<EditPlanClip> {
|
||||
const response = await apiClient.post<EditPlanClip>(`/edit-plans/${planId}/clips`, data)
|
||||
const response = await apiClient.post<EditPlanClip>(`/template-editors/${planId}/clips`, data)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -519,13 +526,16 @@ export async function updateEditPlanClip(
|
||||
clipId: string,
|
||||
data: UpdateEditPlanClipRequest,
|
||||
): Promise<EditPlanClip> {
|
||||
const response = await apiClient.put<EditPlanClip>(`/edit-plans/${planId}/clips/${clipId}`, data)
|
||||
const response = await apiClient.put<EditPlanClip>(
|
||||
`/template-editors/${planId}/clips/${clipId}`,
|
||||
data,
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/** 删除片段 */
|
||||
export async function deleteEditPlanClip(planId: string, clipId: string): Promise<void> {
|
||||
await apiClient.delete(`/edit-plans/${planId}/clips/${clipId}`)
|
||||
await apiClient.delete(`/template-editors/${planId}/clips/${clipId}`)
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
@@ -566,7 +576,7 @@ export async function reorderEditPlanClips(
|
||||
items: ClipReorderItem[],
|
||||
): Promise<ClipReorderResponse> {
|
||||
const response = await apiClient.post<ClipReorderResponse>(
|
||||
`/edit-plans/${planId}/clips/reorder`,
|
||||
`/template-editors/${planId}/clips/reorder`,
|
||||
{ items },
|
||||
)
|
||||
return response.data
|
||||
@@ -578,7 +588,7 @@ export async function batchDeleteEditPlanClips(
|
||||
clipIds: string[],
|
||||
): Promise<ClipBatchDeleteResponse> {
|
||||
const response = await apiClient.post<ClipBatchDeleteResponse>(
|
||||
`/edit-plans/${planId}/clips/batch-delete`,
|
||||
`/template-editors/${planId}/clips/batch-delete`,
|
||||
{ clip_ids: clipIds },
|
||||
)
|
||||
return response.data
|
||||
@@ -591,7 +601,7 @@ export async function createClipsFromAssets(
|
||||
clipType = "main",
|
||||
): Promise<ClipsFromAssetsResponse> {
|
||||
const response = await apiClient.post<ClipsFromAssetsResponse>(
|
||||
`/edit-plans/${planId}/clips/from-assets`,
|
||||
`/template-editors/${planId}/clips/from-assets`,
|
||||
{ asset_ids: assetIds, clip_type: clipType },
|
||||
)
|
||||
return response.data
|
||||
@@ -609,7 +619,7 @@ export interface CopyEditPlanRequest {
|
||||
|
||||
/** 复制模板草稿(含所有片段配置) */
|
||||
export async function copyEditPlan(planId: string, data?: CopyEditPlanRequest): Promise<EditPlan> {
|
||||
const response = await apiClient.post<EditPlan>(`/edit-plans/${planId}/copy`, data || {})
|
||||
const response = await apiClient.post<EditPlan>(`/template-editors/${planId}/copy`, data || {})
|
||||
return response.data
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ import {
|
||||
generateEditPlan,
|
||||
updateEditPlan,
|
||||
getGenerationTaskResults,
|
||||
getGenerationStatus,
|
||||
} from "@/api/editPlans"
|
||||
import type { GeneratedVideo, EditPlanConfig, TitleConfig } from "@/api/editPlans"
|
||||
import type { CoverConfig } from "../editing-planner/types"
|
||||
import { getEditingTemplates } from "@/api/editingPlanner"
|
||||
import { getTitles } from "@/api/titles"
|
||||
import apiClient from "@/api/client"
|
||||
import { fetchPresetVoices } from "@/api/voices"
|
||||
import type { PresetVoiceItem } from "@/api/voices"
|
||||
import { formatDuration } from "@/api/voiceClone"
|
||||
@@ -1028,8 +1028,7 @@ const GeneratePage: React.FC = () => {
|
||||
|
||||
const poll = async () => {
|
||||
try {
|
||||
const status = await apiClient.get(`/edit-plans/${plan.id}/generation-status`)
|
||||
const data = status.data
|
||||
const data = await getGenerationStatus(plan.id)
|
||||
|
||||
if (data.plan_status === "completed") {
|
||||
setProgress(100)
|
||||
|
||||
Reference in New Issue
Block a user