forked from 77media/video-flow
错误 提示
This commit is contained in:
parent
58d0017e98
commit
e9986801ce
@ -669,7 +669,9 @@ export const LOADING_TEXT_MAP = {
|
|||||||
audio: 'Generating background audio...',
|
audio: 'Generating background audio...',
|
||||||
postProduction: (step: string) => `Post-production: ${step}...`,
|
postProduction: (step: string) => `Post-production: ${step}...`,
|
||||||
final: 'Generating final product...',
|
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;
|
} as const;
|
||||||
|
|
||||||
export type Status = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
|
export type Status = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
|
||||||
|
|||||||
@ -98,7 +98,8 @@ const WorkFlow = React.memo(function WorkFlow() {
|
|||||||
handleRetryVideo,
|
handleRetryVideo,
|
||||||
isShowAutoEditing
|
isShowAutoEditing
|
||||||
} = useWorkflowData({
|
} = useWorkflowData({
|
||||||
onEditPlanGenerated: handleEditPlanGenerated
|
onEditPlanGenerated: handleEditPlanGenerated,
|
||||||
|
editingStatus: editingStatus
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import React, { useState, useEffect, useMemo, useRef } from 'react';
|
|||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import { ScriptModal } from '@/components/ui/script-modal';
|
import { ScriptModal } from '@/components/ui/script-modal';
|
||||||
import {
|
import {
|
||||||
CheckCircle,
|
CircleAlert,
|
||||||
Heart,
|
Heart,
|
||||||
Camera,
|
Camera,
|
||||||
Film,
|
Film,
|
||||||
@ -248,8 +248,11 @@ export function TaskInfo({
|
|||||||
currentLoadingText={currentLoadingText}
|
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
|
<motion.div
|
||||||
className="flex items-center gap-2 justify-center"
|
className="flex items-center gap-2 justify-center"
|
||||||
|
|||||||
@ -11,9 +11,10 @@ import { LOADING_TEXT_MAP, TaskObject, Status, Stage } from '@/api/DTO/movieEdit
|
|||||||
|
|
||||||
interface UseWorkflowDataProps {
|
interface UseWorkflowDataProps {
|
||||||
onEditPlanGenerated?: () => void;
|
onEditPlanGenerated?: () => void;
|
||||||
|
editingStatus?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps = {}) {
|
export function useWorkflowData({ onEditPlanGenerated, editingStatus }: UseWorkflowDataProps = {}) {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const episodeId = searchParams.get('episodeId') || '';
|
const episodeId = searchParams.get('episodeId') || '';
|
||||||
const from = searchParams.get('from') || '';
|
const from = searchParams.get('from') || '';
|
||||||
@ -191,14 +192,17 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps =
|
|||||||
setNeedStreamData(true);
|
setNeedStreamData(true);
|
||||||
setIsGenerateEditPlan(false);
|
setIsGenerateEditPlan(false);
|
||||||
|
|
||||||
// 显示失败通知,但保持进度条继续更新
|
// 显示失败通知3秒
|
||||||
showEditingNotification({
|
showEditingNotification({
|
||||||
key: notificationKey,
|
key: notificationKey,
|
||||||
description: `Generating intelligent editing plan... ${retryCount ? 'Retry Time: ' + retryCount : ''}`,
|
description: `Generating intelligent editing plan... ${retryCount ? 'Retry Time: ' + retryCount : ''}`,
|
||||||
timeoutDescription: 'Editing plan generation failed. Retrying later.',
|
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]);
|
}, [episodeId, onEditPlanGenerated, notificationKey]);
|
||||||
|
|
||||||
@ -223,8 +227,15 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps =
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isShowError) {
|
if (isShowError) {
|
||||||
window.msg.error('Too many failed storyboards, unable to execute automatic editing.', 8000);
|
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(() => {
|
useUpdateEffect(() => {
|
||||||
@ -747,6 +758,6 @@ export function useWorkflowData({ onEditPlanGenerated }: UseWorkflowDataProps =
|
|||||||
showGotoCutButton: (canGoToCut && (isGenerateEditPlan || taskObject.currentStage === 'final_video') || isShowError) ? true : false,
|
showGotoCutButton: (canGoToCut && (isGenerateEditPlan || taskObject.currentStage === 'final_video') || isShowError) ? true : false,
|
||||||
generateEditPlan: openEditPlan,
|
generateEditPlan: openEditPlan,
|
||||||
handleRetryVideo,
|
handleRetryVideo,
|
||||||
isShowAutoEditing: canGoToCut && taskObject.currentStage !== 'final_video' ? true : false
|
isShowAutoEditing: canGoToCut && taskObject.currentStage !== 'final_video' && isGenerateEditPlan && !isShowError ? true : false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user