diff --git a/components/pages/work-flow.tsx b/components/pages/work-flow.tsx index 1f024ed..5966bd3 100644 --- a/components/pages/work-flow.tsx +++ b/components/pages/work-flow.tsx @@ -46,7 +46,8 @@ export default function WorkFlow() { mode, setIsPauseWorkFlow, setAnyAttribute, - applyScript + applyScript, + fallbackToStep } = useWorkflowData(); const { @@ -225,8 +226,8 @@ export default function WorkFlow() { {/* 暂停/播放按钮 */} { - currentStep !== '6' && ( -
+ (currentStep !== '6' && currentStep !== '0') && ( +
diff --git a/components/pages/work-flow/use-workflow-data.tsx b/components/pages/work-flow/use-workflow-data.tsx index 26e99d4..2a77e2b 100644 --- a/components/pages/work-flow/use-workflow-data.tsx +++ b/components/pages/work-flow/use-workflow-data.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react'; import { useSearchParams } from 'next/navigation'; -import { detailScriptEpisodeNew, getScriptTitle, getRunningStreamData } from '@/api/video_flow'; +import { detailScriptEpisodeNew, getScriptTitle, getRunningStreamData, pauseMovieProjectPlan, resumeMovieProjectPlan } from '@/api/video_flow'; import { useAppDispatch, useAppSelector } from '@/lib/store/hooks'; import { setSketchCount, setVideoCount } from '@/lib/store/workflowSlice'; import { useScriptService } from "@/app/service/Interaction/ScriptService"; @@ -96,7 +96,7 @@ export function useWorkflowData() { console.log('开始初始化剧本', originalText); originalText && initializeFromProject(episodeId, originalText).then(() => { console.log('应用剧本'); - // 默认模式下 应用剧本 + // 自动模式下 应用剧本;手动模式 需要点击 下一步 触发 mode.includes('auto') && applyScript(); }); }, [originalText]); @@ -110,7 +110,11 @@ export function useWorkflowData() { }, [scriptBlocksMemo]); // 监听继续 请求更新数据 useEffect(() => { - + if (isPauseWorkFlow) { + pauseMovieProjectPlan({ project_id: episodeId }); + } else { + resumeMovieProjectPlan({ project_id: episodeId }); + } }, [isPauseWorkFlow]); // 自动开始播放一轮 @@ -568,6 +572,12 @@ export function useWorkflowData() { } }; + // 回退到 指定状态 重新获取数据 + const fallbackToStep = (step: string) => { + setCurrentStep(step); + setNeedStreamData(true); + } + // 重试加载数据 const retryLoadData = () => { setDataLoadError(null); @@ -617,6 +627,7 @@ export function useWorkflowData() { mode, setIsPauseWorkFlow, setAnyAttribute, - applyScript + applyScript, + fallbackToStep }; } diff --git a/components/ui/edit-modal.tsx b/components/ui/edit-modal.tsx index 36b7baa..3c3024b 100644 --- a/components/ui/edit-modal.tsx +++ b/components/ui/edit-modal.tsx @@ -29,6 +29,7 @@ interface EditModalProps { isPauseWorkFlow: boolean; scriptData: any[] | null; applyScript: any; + fallbackToStep: any; } const tabs = [ @@ -57,7 +58,8 @@ export function EditModal({ setAnyAttribute, isPauseWorkFlow, scriptData, - applyScript + applyScript, + fallbackToStep }: EditModalProps) { const [activeTab, setActiveTab] = useState(activeEditTab); const [currentIndex, setCurrentIndex] = useState(currentSketchIndex); @@ -104,6 +106,13 @@ export function EditModal({ const handleConfirmGotoFallback = () => { console.log('handleConfirmGotoFallback'); + if (activeTab === '0') { + fallbackToStep('0'); + // 应用剧本 + applyScript(); + } else { + fallbackToStep('1'); + } } const handleCloseRemindFallbackPanel = () => { setIsRemindFallbackOpen(false); @@ -295,7 +304,7 @@ export function EditModal({
-

将重新生成视频并剪辑,是否需要继续?

+

The task will be regenerated and edited. Do you want to continue?

@@ -305,7 +314,7 @@ export function EditModal({ className="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-md transition-colors duration-200 flex items-center gap-2" > - 继续 + Continue
diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 1bfc3b5..11cbf63 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -236,7 +236,7 @@ export function ShotTabContent({ >
- Segment {index + 1} + Segment {index + 1} {shot.status === 0 && ( )}