From 7c4c956be0c3c4c2f76f181e356779003bc8f998 Mon Sep 17 00:00:00 2001
From: log
Date: Thu, 25 Jun 2026 22:21:07 +0800
Subject: [PATCH] fix: replace favicon.ico with icon.png to resolve build error

---
 video-claw/video-claw/frontend/components/WorkflowPanel.tsx |   67 +++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/video-claw/video-claw/frontend/components/WorkflowPanel.tsx b/video-claw/video-claw/frontend/components/WorkflowPanel.tsx
index 7bfa050..c3dbf69 100644
--- a/video-claw/video-claw/frontend/components/WorkflowPanel.tsx
+++ b/video-claw/video-claw/frontend/components/WorkflowPanel.tsx
@@ -131,15 +131,23 @@
   const [history, setHistory] = useState<HistoryItem[]>([]);
   const [projectParams, setProjectParams] = useState<ProjectParams | null>(null);
   const [autoMode, setAutoMode] = useState(false);
-  const [videoSound, setVideoSound] = useState('on');
-  const [videoShotType, setVideoShotType] = useState('multi');
   // 用于顶栏流程图状态判断
   const [currentStageFromSession, setCurrentStageFromSession] = useState<string | null>(null);
   const [completedStagesFromSession, setCompletedStagesFromSession] = useState<string[]>([]);
 
   const abortRef = useRef<AbortController | null>(null);
   const stoppedRef = useRef(false);
+  const autoModeRef = useRef(autoMode);
   const pollRef = useRef<Set<string>>(new Set());
+
+  useEffect(() => {
+    autoModeRef.current = autoMode;
+  }, [autoMode]);
+
+  const handleAutoModeChange = useCallback((nextAutoMode: boolean) => {
+    autoModeRef.current = nextAutoMode;
+    setAutoMode(nextAutoMode);
+  }, []);
 
   // 清理轮询
   useEffect(() => {
@@ -508,7 +516,7 @@
     if (isRunning) return;
     stoppedRef.current = false;
     const useAutoMode = autoOverride !== undefined ? autoOverride : autoMode;
-    if (autoOverride !== undefined) setAutoMode(autoOverride);
+    if (autoOverride !== undefined) handleAutoModeChange(autoOverride);
     setIsRunning(true);
     setStageStates(initStageStates());
     setProjectParams(params);
@@ -524,6 +532,10 @@
         vlm_model: params.vlm_model,
         image_t2i_model: params.image_t2i_model,
         image_it2i_model: params.image_it2i_model,
+        video_generation_mode: params.video_generation_mode,
+        video_first_frame_model: params.video_first_frame_model,
+        video_start_end_model: params.video_start_end_model,
+        video_reference_model: params.video_reference_model,
         video_model: params.video_model,
         enable_concurrency: params.enable_concurrency,
         web_search: params.web_search,
@@ -555,6 +567,10 @@
         vlm_model: params.vlm_model,
         image_t2i_model: params.image_t2i_model,
         image_it2i_model: params.image_it2i_model,
+        video_generation_mode: params.video_generation_mode,
+        video_first_frame_model: params.video_first_frame_model,
+        video_start_end_model: params.video_start_end_model,
+        video_reference_model: params.video_reference_model,
         video_model: params.video_model,
         scene_number: result.params?.scene_number,
         expand_idea: params.expand_idea,
@@ -584,7 +600,7 @@
         // waiting: 等待用户介入(如选择角色/图片),不能自动 continue
         // completed: 阶段完成,等待确认进入下一阶段
         if (stageStatus === 'completed' || stageStatus === 'session_completed') {
-          if (useAutoMode) {
+          if (autoModeRef.current) {
             // 代理模式:自动确认并继续
             await continueWorkflow(result.session_id);
             updateStageState(stageId, { status: 'completed', progressMessage: '已自动确认' });
@@ -638,11 +654,15 @@
           vlm_model: projectParams?.vlm_model,
           image_t2i_model: projectParams?.image_t2i_model,
           image_it2i_model: projectParams?.image_it2i_model,
+          video_generation_mode: projectParams?.video_generation_mode,
+          video_first_frame_model: projectParams?.video_first_frame_model,
+          video_start_end_model: projectParams?.video_start_end_model,
+          video_reference_model: projectParams?.video_reference_model,
           video_model: projectParams?.video_model,
           video_ratio: projectParams?.video_ratio,
           video_resolution: projectParams?.video_resolution,
-          video_sound: videoSound,
-          video_shot_type: videoShotType,
+          video_sound: 'on',
+          video_shot_type: 'multi',
         };
         // 从剧本产物获取实际场景数
         try {
@@ -691,7 +711,7 @@
           // waiting: 等待用户介入(如选择角色/图片),不能自动 continue
           // completed: 阶段完成,等待确认进入下一阶段,可以自动 continue
           if (nStageStatus === 'completed' || nStageStatus === 'session_completed') {
-            if (autoMode) {
+            if (autoModeRef.current) {
               await continueWorkflow(sessionId);
               updateStageState(nextStage, { status: 'completed', progressMessage: '已自动确认' });
               setCompletedStagesFromSession(prev => [...prev, nextStage]);
@@ -741,9 +761,13 @@
       vlm_model: projectParams?.vlm_model,
       image_t2i_model: projectParams?.image_t2i_model,
       image_it2i_model: projectParams?.image_it2i_model,
+      video_generation_mode: projectParams?.video_generation_mode,
+      video_first_frame_model: projectParams?.video_first_frame_model,
+      video_start_end_model: projectParams?.video_start_end_model,
+      video_reference_model: projectParams?.video_reference_model,
       video_model: projectParams?.video_model,
-      video_sound: videoSound,
-      video_shot_type: videoShotType,
+      video_sound: 'on',
+      video_shot_type: 'multi',
     };
 
     // 设置 running 状态以便显示进度条(如 Logline 选择后生成剧本)
@@ -1037,6 +1061,10 @@
         vlm_model: projectParams?.vlm_model,
         image_t2i_model: projectParams?.image_t2i_model,
         image_it2i_model: projectParams?.image_it2i_model,
+        video_generation_mode: projectParams?.video_generation_mode,
+        video_first_frame_model: projectParams?.video_first_frame_model,
+        video_start_end_model: projectParams?.video_start_end_model,
+        video_reference_model: projectParams?.video_reference_model,
         video_model: projectParams?.video_model,
         video_ratio: projectParams?.video_ratio,
         video_resolution: projectParams?.video_resolution,
@@ -1143,6 +1171,8 @@
       const meta = ((status as any).meta || {}) as any;
       const s = Object.keys(meta).length > 0 ? meta : (status as any);
       if (s.idea || s.user_textbox_input) {
+        // Legacy session compatibility: old sessions only stored one video_model, so hydrate it as the first-frame model.
+        const restoredFirstFrameVideoModel = s.video_first_frame_model || s.video_model || '';
         setProjectParams({
           idea: s.idea || s.user_textbox_input || '',
           style: s.style || '',
@@ -1152,6 +1182,10 @@
           vlm_model: s.vlm_model || '',
           image_t2i_model: s.image_t2i_model || '',
           image_it2i_model: s.image_it2i_model || '',
+          video_generation_mode: s.video_generation_mode || 'first_frame',
+          video_first_frame_model: restoredFirstFrameVideoModel,
+          video_start_end_model: s.video_start_end_model || 'wan2.7-i2v',
+          video_reference_model: s.video_reference_model || 'wan2.7-r2v',
           video_model: s.video_model || '',
           expand_idea: s.expand_idea || false,
           enable_concurrency: s.enable_concurrency || false,
@@ -1215,6 +1249,11 @@
         vlm_model: projectParams.vlm_model,
         image_t2i_model: projectParams.image_t2i_model,
         image_it2i_model: projectParams.image_it2i_model,
+        // Legacy session compatibility: projectParams may come from an old session with only video_model.
+        video_generation_mode: projectParams.video_generation_mode || 'first_frame',
+        video_first_frame_model: projectParams.video_first_frame_model || projectParams.video_model,
+        video_start_end_model: projectParams.video_start_end_model || 'wan2.7-i2v',
+        video_reference_model: projectParams.video_reference_model || 'wan2.7-r2v',
         video_model: projectParams.video_model,
         video_ratio: projectParams.video_ratio,
         video_resolution: projectParams.video_resolution || '720P',
@@ -1248,7 +1287,7 @@
   }
 
   // ── 计算项目状态 ──
-  // 后端状态: pending, running, waiting, completed, completed, error
+  // 后端阶段状态: pending, running, waiting, completed, stopped, error
   // 前端 StageStatus: pending, running, waiting, completed, error
   const hasRunning = Object.values(stageStates).some(s => s.status === 'running');
   const hasWaiting = Object.values(stageStates).some(s => s.status === 'waiting');
@@ -1333,12 +1372,6 @@
         isRunning={effectiveIsRunning}
         hasPendingItems={hasPendingItems}
         hasNextStageStarted={hasNextStageStarted}
-        videoSound={videoSound}
-        videoShotType={videoShotType}
-        onVideoParamsChange={(params: { videoSound?: string; videoShotType?: string }) => {
-          if (params.videoSound !== undefined) setVideoSound(params.videoSound);
-          if (params.videoShotType !== undefined) setVideoShotType(params.videoShotType);
-        }}
         referenceArtifact={referenceArtifact}
         scriptArtifact={scriptArtifact}
         artifacts={Object.keys(stageStates).reduce((acc: any, key) => {
@@ -1362,7 +1395,7 @@
         isRunning={effectiveIsRunning}
         onStop={handleStop}
         autoMode={autoMode}
-        onAutoModeChange={setAutoMode}
+        onAutoModeChange={handleAutoModeChange}
         modelConfig={modelConfig}
         onModelConfigChange={handleModelConfigChange}
         projectStatus={projectStatus}

--
Gitblit v1.8.0