forked from 77media/video-flow
Revert "去掉调用剪辑计划"
This reverts commit 22e1962841fe2e99ee4bb00f44eabb1880ef0212.
This commit is contained in:
parent
22e1962841
commit
87cfdf2e9d
@ -1,8 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<<<<<<< Updated upstream
|
||||||
NEXT_PUBLIC_JAVA_URL = https://77.app.java.auth.qikongjian.com
|
NEXT_PUBLIC_JAVA_URL = https://77.app.java.auth.qikongjian.com
|
||||||
# NEXT_PUBLIC_JAVA_URL = http://192.168.120.83:8080
|
# NEXT_PUBLIC_JAVA_URL = http://192.168.120.83:8080
|
||||||
NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com
|
NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com
|
||||||
NEXT_PUBLIC_CUT_URL = https://smartcut.huiying.video
|
NEXT_PUBLIC_CUT_URL = https://smartcut.huiying.video
|
||||||
|
=======
|
||||||
|
# NEXT_PUBLIC_JAVA_URL = https://77.app.java.auth.qikongjian.com
|
||||||
|
# NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com
|
||||||
|
# NEXT_PUBLIC_CUT_URL = https://smartcut.huiying.video
|
||||||
|
NEXT_PUBLIC_JAVA_URL = https://auth.movieflow.ai
|
||||||
|
NEXT_PUBLIC_BASE_URL = https://api.video.movieflow.ai
|
||||||
|
NEXT_PUBLIC_CUT_URL = https://smartcut.movieflow.ai
|
||||||
|
>>>>>>> Stashed changes
|
||||||
# 失败率
|
# 失败率
|
||||||
NEXT_PUBLIC_ERROR_CONFIG = 0.1
|
NEXT_PUBLIC_ERROR_CONFIG = 0.1
|
||||||
@ -3,6 +3,7 @@
|
|||||||
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
||||||
import { useSearchParams } from 'next/navigation';
|
import { useSearchParams } from 'next/navigation';
|
||||||
import { notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
|
import { showEditingNotification } from '@/components/pages/work-flow/editing-notification';
|
||||||
import { detailScriptEpisodeNew, getScriptTitle, getRunningStreamData, pauseMovieProjectPlan, resumeMovieProjectPlan, getGenerateEditPlan, regenerateVideoNew } from '@/api/video_flow';
|
import { detailScriptEpisodeNew, getScriptTitle, getRunningStreamData, pauseMovieProjectPlan, resumeMovieProjectPlan, getGenerateEditPlan, regenerateVideoNew } from '@/api/video_flow';
|
||||||
import { useScriptService } from "@/app/service/Interaction/ScriptService";
|
import { useScriptService } from "@/app/service/Interaction/ScriptService";
|
||||||
import { useUpdateEffect } from '@/app/hooks/useUpdateEffect';
|
import { useUpdateEffect } from '@/app/hooks/useUpdateEffect';
|
||||||
@ -140,6 +141,66 @@ export function useWorkflowData({ onEditPlanGenerated, editingStatus, onExportFa
|
|||||||
}
|
}
|
||||||
}, [taskObject.currentStage]);
|
}, [taskObject.currentStage]);
|
||||||
|
|
||||||
|
const generateEditPlan = useCallback(async (retryCount: number) => {
|
||||||
|
if (isLoadedRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 调用重置方法
|
||||||
|
const resetFunc = (window as any)[`resetProgress_${notificationKey}`];
|
||||||
|
if (resetFunc) {
|
||||||
|
resetFunc();
|
||||||
|
}
|
||||||
|
// 更新通知内容
|
||||||
|
showEditingNotification({
|
||||||
|
key: notificationKey,
|
||||||
|
description: `Generating intelligent editing plan... ${retryCount ? 'Retry Time: ' + retryCount : ''}`,
|
||||||
|
successDescription: 'Editing plan generated successfully.',
|
||||||
|
timeoutDescription: 'Editing plan generation failed. Please refresh and try again.',
|
||||||
|
timeout: 8 * 60 * 1000
|
||||||
|
});
|
||||||
|
// 先停止轮询
|
||||||
|
await new Promise(resolve => {
|
||||||
|
setNeedStreamData(false);
|
||||||
|
resolve(true);
|
||||||
|
});
|
||||||
|
setIsLoadingGenerateEditPlan(true);
|
||||||
|
try {
|
||||||
|
const response = await getGenerateEditPlan({ project_id: episodeId });
|
||||||
|
if (!response.data.editing_plan) {
|
||||||
|
throw new Error(response.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error('生成剪辑计划成功');
|
||||||
|
setIsGenerateEditPlan(true);
|
||||||
|
isLoadedRef.current = 'true';
|
||||||
|
setNeedStreamData(true);
|
||||||
|
|
||||||
|
// 销毁生成计划的通知
|
||||||
|
notification.destroy(notificationKey);
|
||||||
|
|
||||||
|
// 触发回调,通知父组件计划生成完成
|
||||||
|
console.log('📞 calling onEditPlanGenerated callback');
|
||||||
|
onEditPlanGenerated?.();
|
||||||
|
setIsLoadingGenerateEditPlan(false);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('生成剪辑计划失败:', error);
|
||||||
|
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: 3000
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
notification.destroy(notificationKey);
|
||||||
|
setIsLoadingGenerateEditPlan(false);
|
||||||
|
}, 8000);
|
||||||
|
}
|
||||||
|
}, [episodeId, onEditPlanGenerated, notificationKey]);
|
||||||
|
|
||||||
const openEditPlan = useCallback(async () => {
|
const openEditPlan = useCallback(async () => {
|
||||||
window.open(`${cutUrl}/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target');
|
window.open(`${cutUrl}/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target');
|
||||||
}, [episodeId]);
|
}, [episodeId]);
|
||||||
@ -147,7 +208,7 @@ export function useWorkflowData({ onEditPlanGenerated, editingStatus, onExportFa
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 主动触发剪辑
|
// 主动触发剪辑
|
||||||
if (canGoToCut && taskObject.currentStage === 'video' && !isShowError) {
|
if (canGoToCut && taskObject.currentStage === 'video' && !isShowError) {
|
||||||
onEditPlanGenerated?.();
|
generateEditPlan(retryCount - 1);
|
||||||
}
|
}
|
||||||
}, [canGoToCut, taskObject.currentStage, retryCount, isShowError]);
|
}, [canGoToCut, taskObject.currentStage, retryCount, isShowError]);
|
||||||
|
|
||||||
@ -350,6 +411,17 @@ export function useWorkflowData({ onEditPlanGenerated, editingStatus, onExportFa
|
|||||||
// 只在第一次检测到视频分析任务时显示通知
|
// 只在第一次检测到视频分析任务时显示通知
|
||||||
if (analyze_video_total_count > 0 && !isAnalyzing && analyze_video_completed_count !== analyze_video_total_count) {
|
if (analyze_video_total_count > 0 && !isAnalyzing && analyze_video_completed_count !== analyze_video_total_count) {
|
||||||
setIsAnalyzing(true);
|
setIsAnalyzing(true);
|
||||||
|
// 如果是第一次显示通知,才调用showEditingNotification
|
||||||
|
const resetFunc = (window as any)[`resetProgress_${notificationKey}`];
|
||||||
|
if (!resetFunc) {
|
||||||
|
showEditingNotification({
|
||||||
|
key: notificationKey,
|
||||||
|
description: 'Preparing intelligent editing plan...',
|
||||||
|
successDescription: 'Preparing successful',
|
||||||
|
timeoutDescription: 'Preparing failed, please try again',
|
||||||
|
timeout: 3 * 60 * 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analyze_video_total_count && analyze_video_completed_count === analyze_video_total_count) {
|
if (analyze_video_total_count && analyze_video_completed_count === analyze_video_total_count) {
|
||||||
@ -360,6 +432,7 @@ export function useWorkflowData({ onEditPlanGenerated, editingStatus, onExportFa
|
|||||||
setIsAnalyzing(false);
|
setIsAnalyzing(false);
|
||||||
} else {
|
} else {
|
||||||
setIsShowError(true);
|
setIsShowError(true);
|
||||||
|
notification.destroy(notificationKey);
|
||||||
setIsAnalyzing(false);
|
setIsAnalyzing(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user