错误 提示

This commit is contained in:
北枳 2025-09-08 23:50:34 +08:00
parent 58d0017e98
commit e9986801ce
4 changed files with 28 additions and 11 deletions

View File

@ -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';

View File

@ -98,7 +98,8 @@ const WorkFlow = React.memo(function WorkFlow() {
handleRetryVideo,
isShowAutoEditing
} = useWorkflowData({
onEditPlanGenerated: handleEditPlanGenerated
onEditPlanGenerated: handleEditPlanGenerated,
editingStatus: editingStatus
});
const {

View File

@ -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') ? (
<motion.div className='flex items-center gap-2 justify-center'>
<CircleAlert className="w-4 h-4 text-red-500/80" />
<span className="normalS400 subtitle-had8uE text-transparent bg-clip-text">{currentLoadingText}</span>
</motion.div>
) : (
<motion.div
className="flex items-center gap-2 justify-center"

View File

@ -11,9 +11,10 @@ import { LOADING_TEXT_MAP, TaskObject, Status, Stage } from '@/api/DTO/movieEdit
interface UseWorkflowDataProps {
onEditPlanGenerated?: () => 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
};
}