From 1aec298dd84a3ff39fa1d939739bf80597b1aeab Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Tue, 1 Jul 2025 22:04:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=91=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pages/create-to-video2.tsx | 38 +++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/components/pages/create-to-video2.tsx b/components/pages/create-to-video2.tsx index 8458674..142f629 100644 --- a/components/pages/create-to-video2.tsx +++ b/components/pages/create-to-video2.tsx @@ -106,6 +106,23 @@ export function CreateToVideo2() { } const handleCreateVideo = async () => { + // 创建剧集数据 + const episodeData: CreateScriptEpisodeRequest = { + title: "episode 1", + script_id: projectId, + status: 1, + summary: script + }; + + // 调用创建剧集API + const episodeResponse = await createScriptEpisode(episodeData); + if (episodeResponse.code !== 0) { + console.error(`创建剧集失败: ${episodeResponse.message}`); + alert(`创建剧集失败: ${episodeResponse.message}`); + return; + } + let episodeId = episodeResponse.data.id ; + if (videoUrl || script) { try { setIsCreating(true); @@ -131,27 +148,10 @@ export function CreateToVideo2() { } convertResponse = await convertVideoToScene(videoUrl, episodeId, projectId); } - // 检查转换结果 if (convertResponse.code === 0) { - // 确定项目类型 - // 创建剧集数据 - const episodeData: CreateScriptEpisodeRequest = { - title: "episode 1", - script_id: projectId, - status: 1, - summary: script - }; - - // 调用创建剧集API - const episodeResponse = await createScriptEpisode(episodeData); - - if (episodeResponse.code === 0) { - // 成功创建后跳转到work-flow页面, 并设置episodeId 和 projectType - router.push(`/create/work-flow?episodeId=${episodeResponse.data.id}`); - } else { - alert(`创建剧集失败: ${episodeResponse.message}`); - } + // 成功创建后跳转到work-flow页面, 并设置episodeId 和 projectType + router.push(`/create/work-flow?episodeId=${episodeResponse.data.id}`); } else { alert(`转换失败: ${convertResponse.message}`); }