fix(script): 脚本按向导选的成片时长生成,不再写死 60 秒

pipeline 调脚本 agent 时 total_duration 写死成 60,忽略了向导里选的时长(选 30s 也按 60s 出)。
改为从 project.metadata.wizard.duration("0-30"→30)解析后传入;缺省回落 60。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-24 00:56:33 +08:00
co-authored by Claude Opus 4.8
parent 79fc95f1b7
commit dee269aeda
+7 -1
View File
@@ -998,6 +998,12 @@ export function PipelinePage(props: {
const [setupSource, setSetupSource] = useState<"ai" | "theme" | "manual">("ai");
const [setupStyle, setSetupStyle] = useState<string>(project.metadata?.wizard?.script_style || SETUP_STYLE_KEYS[0] || "pain");
const [setupPersona, setSetupPersona] = useState<string>(project.metadata?.wizard?.persona || SETUP_PERSONA_KEYS[0] || "urban");
// 向导选的成片时长档("0-30"→30 秒)传给脚本 agent —— 脚本按它定镜数,别再写死 60(否则选 30s 也按 60s 出)
const wizardTotalDuration = (() => {
const raw = project.metadata?.wizard?.duration;
const m = /(\d+)\s*$/.exec(typeof raw === "string" ? raw : "");
return m ? Number(m[1]) : 60;
})();
const chatTextareaRef = useRef<HTMLTextAreaElement | null>(null);
const chatFileRef = useRef<HTMLInputElement | null>(null);
const chatBodyRef = useRef<HTMLDivElement | null>(null);
@@ -1152,7 +1158,7 @@ export function PipelinePage(props: {
model_config_id: activeScriptModelId || undefined,
base_version_id: baseVersionId,
aspect_ratio: "9:16",
total_duration: 60,
total_duration: wizardTotalDuration,
target_index: targetIndex
},
(evt) => {