diff --git a/api/DTO/movieEdit.ts b/api/DTO/movieEdit.ts index 45690ec..aa61fde 100644 --- a/api/DTO/movieEdit.ts +++ b/api/DTO/movieEdit.ts @@ -669,7 +669,9 @@ export const LOADING_TEXT_MAP = { audio: 'Generating background audio...', postProduction: (step: string) => `Post-production: ${step}...`, final: 'Generating final product...', - complete: 'Task completed' + complete: 'Task completed', + toManyFailed: 'Too many failed storyboards, Please click the edit button to go to the intelligent editing platform.', + editingError: 'Editing failed. Please refresh the page and try again.' } as const; export type Status = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED'; diff --git a/components/pages/work-flow.tsx b/components/pages/work-flow.tsx index f4f3409..1d98d3d 100644 --- a/components/pages/work-flow.tsx +++ b/components/pages/work-flow.tsx @@ -98,7 +98,8 @@ const WorkFlow = React.memo(function WorkFlow() { handleRetryVideo, isShowAutoEditing } = useWorkflowData({ - onEditPlanGenerated: handleEditPlanGenerated + onEditPlanGenerated: handleEditPlanGenerated, + editingStatus: editingStatus }); const { diff --git a/components/pages/work-flow/task-info.tsx b/components/pages/work-flow/task-info.tsx index b32184b..ae2e1c5 100644 --- a/components/pages/work-flow/task-info.tsx +++ b/components/pages/work-flow/task-info.tsx @@ -4,7 +4,7 @@ import React, { useState, useEffect, useMemo, useRef } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { ScriptModal } from '@/components/ui/script-modal'; import { - CheckCircle, + CircleAlert, Heart, Camera, Film, @@ -248,8 +248,11 @@ export function TaskInfo({ currentLoadingText={currentLoadingText} /> - {currentLoadingText === 'Task completed' ? ( - <> + {currentLoadingText.includes('failed') ? ( + + + {currentLoadingText} + ) : ( void; + editingStatus?: string; } -export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps = {}) { +export function useWorkflowData({ onEditPlanGenerated, editingStatus }: UseWorkflowDataProps = {}) { const searchParams = useSearchParams(); const episodeId = searchParams.get('episodeId') || ''; const from = searchParams.get('from') || ''; @@ -191,14 +192,17 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps = setNeedStreamData(true); setIsGenerateEditPlan(false); - // 显示失败通知,但保持进度条继续更新 + // 显示失败通知3秒 showEditingNotification({ key: notificationKey, description: `Generating intelligent editing plan... ${retryCount ? 'Retry Time: ' + retryCount : ''}`, timeoutDescription: 'Editing plan generation failed. Retrying later.', - timeout: 8 * 60 * 1000 // 延长超时时间到8分钟,给重试留出足够时间 + timeout: 3000 }); - setIsLoadingGenerateEditPlan(false); + setTimeout(() => { + notification.destroy(notificationKey); + setIsLoadingGenerateEditPlan(false); + }, 8000); } }, [episodeId, onEditPlanGenerated, notificationKey]); @@ -223,8 +227,15 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps = useEffect(() => { if (isShowError) { window.msg.error('Too many failed storyboards, unable to execute automatic editing.', 8000); + setCurrentLoadingText(LOADING_TEXT_MAP.toManyFailed); } - }, [isShowError]); + if (editingStatus === 'error') { + window.msg.error('Editing failed, Please click the edit button to go to the intelligent editing platform.', 8000); + setCurrentLoadingText(LOADING_TEXT_MAP.editingError); + } + // 停止轮询 + setNeedStreamData(false); + }, [isShowError, editingStatus]); useUpdateEffect(() => { @@ -747,6 +758,6 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps = showGotoCutButton: (canGoToCut && (isGenerateEditPlan || taskObject.currentStage === 'final_video') || isShowError) ? true : false, generateEditPlan: openEditPlan, handleRetryVideo, - isShowAutoEditing: canGoToCut && taskObject.currentStage !== 'final_video' ? true : false + isShowAutoEditing: canGoToCut && taskObject.currentStage !== 'final_video' && isGenerateEditPlan && !isShowError ? true : false }; }