From 6555eb35a6745d684f5e90151a093ad9c5735c2b Mon Sep 17 00:00:00 2001 From: qikongjian Date: Sun, 31 Aug 2025 01:42:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0AI=E5=89=AA=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=B0=E5=B7=A5=E4=BD=9C=E6=B5=81=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增AIEditingIconButton组件引用 - 添加AI剪辑进度状态管理 - 实现AI剪辑完成和错误处理回调 - 在视频阶段显示AI剪辑按钮 --- components/pages/work-flow.tsx | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/components/pages/work-flow.tsx b/components/pages/work-flow.tsx index ca04305..1f58411 100644 --- a/components/pages/work-flow.tsx +++ b/components/pages/work-flow.tsx @@ -16,6 +16,7 @@ import { SaveEditUseCase } from "@/app/service/usecase/SaveEditUseCase"; import { useSearchParams } from "next/navigation"; import SmartChatBox from "@/components/SmartChatBox/SmartChatBox"; import { Drawer } from 'antd'; +import { AIEditingIconButton } from './work-flow/ai-editing-button'; const WorkFlow = React.memo(function WorkFlow() { useEffect(() => { @@ -29,6 +30,7 @@ const WorkFlow = React.memo(function WorkFlow() { const [previewVideoUrl, setPreviewVideoUrl] = React.useState(null); const [previewVideoId, setPreviewVideoId] = React.useState(null); const [isFocusChatInput, setIsFocusChatInput] = React.useState(false); + const [aiEditingInProgress, setAiEditingInProgress] = React.useState(false); const searchParams = useSearchParams(); const episodeId = searchParams.get('episodeId') || ''; @@ -78,6 +80,28 @@ const WorkFlow = React.memo(function WorkFlow() { setIsEditModalOpen(true); }, []); + // AI剪辑回调函数 + const handleAIEditingComplete = useCallback((finalVideoUrl: string) => { + console.log('🎉 AI剪辑完成,最终视频URL:', finalVideoUrl); + + // 更新任务对象的最终视频状态 + setAnyAttribute('final', { + url: finalVideoUrl, + note: 'ai_edited' + }); + + // 切换到最终视频阶段 + setAnyAttribute('currentStage', 'final_video'); + + setAiEditingInProgress(false); + }, [setAnyAttribute]); + + const handleAIEditingError = useCallback((error: string) => { + console.error('❌ AI剪辑失败:', error); + // 这里可以显示错误提示 + setAiEditingInProgress(false); + }, []); + return (
@@ -194,6 +218,22 @@ const WorkFlow = React.memo(function WorkFlow() { ) } + {/* AI剪辑按钮 - 当有视频片段时显示 */} + { + (taskObject.currentStage === 'video' && taskObject.videos.data.length > 0) && ( +
+ +
+ ) + } + {/* 智能对话按钮 */}