From 6e8331d3dfcbb3a717c7344bf65901111366cd8d Mon Sep 17 00:00:00 2001 From: Zixin Zhou Date: Wed, 3 Sep 2025 18:04:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=83=8C=E4=BA=86=E5=85=AD=E5=B9=B4?= =?UTF-8?q?=E5=8D=8A=20=E6=88=91=E6=AF=8F=E4=B8=80=E5=A4=A9=E9=99=AA?= =?UTF-8?q?=E5=AE=83=E4=B8=8A=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layout/top-bar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/layout/top-bar.tsx b/components/layout/top-bar.tsx index 3a40c78..1f78b40 100644 --- a/components/layout/top-bar.tsx +++ b/components/layout/top-bar.tsx @@ -48,7 +48,7 @@ export function TopBar({ collapsed }: { collapsed: boolean }) { const [isLogin, setIsLogin] = useState(false); const [isManagingSubscription, setIsManagingSubscription] = useState(false); const [subscriptionStatus, setSubscriptionStatus] = useState(""); - const [credits, setCredits] = useState(100); + const [credits, setCredits] = useState(0); const [isLoadingSubscription, setIsLoadingSubscription] = useState(false); // 获取用户订阅信息 From 2820ce0c4db8b4e5ca68b90f0b0079a2d9274a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 3 Sep 2025 19:10:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=EF=BC=9A=E5=88=86=E9=95=9C=E4=B8=8B=E8=BD=BD=E3=80=81=E6=9C=80?= =?UTF-8?q?=E7=BB=88=E8=A7=86=E9=A2=91=E4=B8=8B=E8=BD=BD=E3=80=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E8=A7=86=E9=A2=91=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pages/create-to-video2.tsx | 21 ++++++++++++++++--- components/pages/work-flow/media-viewer.tsx | 16 +++++++------- .../pages/work-flow/use-workflow-data.tsx | 2 +- utils/tools.ts | 17 +++++++++++++++ 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/components/pages/create-to-video2.tsx b/components/pages/create-to-video2.tsx index 0a1fe47..7f4da38 100644 --- a/components/pages/create-to-video2.tsx +++ b/components/pages/create-to-video2.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useEffect, useRef, useCallback } from 'react'; -import { Loader2, Check, Pencil, Trash } from 'lucide-react'; +import { Loader2, Check, Pencil, Trash, Download } from 'lucide-react'; import { useRouter } from 'next/navigation'; import './style/create-to-video2.css'; @@ -10,6 +10,9 @@ import { ChatInputBox } from '@/components/ChatInputBox/ChatInputBox'; import cover_image1 from '@/public/assets/cover_image3.jpg'; import { motion } from 'framer-motion'; import { Tooltip, Button } from 'antd'; +import { GlassIconButton } from '@/components/ui/glass-icon-button'; +import { downloadVideo } from '@/utils/tools'; + // ideaText已迁移到ChatInputBox组件中 @@ -217,6 +220,18 @@ export default function CreateToVideo2() { /> )} + {/* 下载按钮 右上角 */} + {(project.final_video_url || project.final_simple_video_url) && ( +
+ + + +
+ )} + + {/* 状态标签 - 左上角 */}
{StatusBadge((project.status === 'COMPLETED' || project.final_simple_video_url) ? 'completed' : project.status === 'FAILED' ? 'failed' : 'pending')} @@ -232,12 +247,12 @@ export default function CreateToVideo2() { {/* TODO 编辑标题 */} {/* - + */}
{/* TODO 删除 */} {/* - + */} diff --git a/components/pages/work-flow/media-viewer.tsx b/components/pages/work-flow/media-viewer.tsx index d005b41..c009940 100644 --- a/components/pages/work-flow/media-viewer.tsx +++ b/components/pages/work-flow/media-viewer.tsx @@ -10,7 +10,7 @@ import { mockScriptData } from '@/components/script-renderer/mock'; import { Skeleton } from '@/components/ui/skeleton'; import { TaskObject } from '@/api/DTO/movieEdit'; import { Button, Tooltip } from 'antd'; -import { Video } from 'lucide-react'; +import { downloadVideo } from '@/utils/tools'; interface MediaViewerProps { taskObject: TaskObject; @@ -273,14 +273,6 @@ export const MediaViewer = React.memo(function MediaViewer({ }; }, []); - // 下载视频 - const downloadVideo = (url: string) => { - const a = document.createElement('a'); - a.href = url; - a.download = url.split('/').pop() || ''; - a.click(); - }; - // 渲染音量控制组件 const renderVolumeControls = () => (
@@ -371,6 +363,12 @@ export const MediaViewer = React.memo(function MediaViewer({ onClick={() => handleEditClick('3', 'final')} /> + {/* 下载按钮 */} + + { + downloadVideo(taskObject.final.url); + }} /> + {showGotoCutButton && ( diff --git a/components/pages/work-flow/use-workflow-data.tsx b/components/pages/work-flow/use-workflow-data.tsx index 98310c9..0305917 100644 --- a/components/pages/work-flow/use-workflow-data.tsx +++ b/components/pages/work-flow/use-workflow-data.tsx @@ -397,7 +397,7 @@ export function useWorkflowData() { const { current: taskCurrent } = tempTaskObject; - taskCurrent.title = title || 'generating...'; + taskCurrent.title = name || 'generating...'; taskCurrent.tags = tags || []; taskCurrent.status = status as Status; diff --git a/utils/tools.ts b/utils/tools.ts index 444a947..7a79fd3 100644 --- a/utils/tools.ts +++ b/utils/tools.ts @@ -77,3 +77,20 @@ export function createScreenAdapter(): void { // 将样式添加到head document.head.appendChild(style); } + +export const downloadVideo = async (url: string) => { + try { + const response = await fetch(url); + const blob = await response.blob(); + const blobUrl = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = blobUrl; + a.download = url.split('/').pop() || 'video.mp4'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + window.URL.revokeObjectURL(blobUrl); + } catch (error) { + console.error('下载视频失败:', error); + } +}; \ No newline at end of file From 7efa73a5248ecddd669661b3512c4e29f387d652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 3 Sep 2025 20:26:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=AFnull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/SmartChatBox/api.ts | 6 +++- .../pages/work-flow/use-workflow-data.tsx | 30 +++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/components/SmartChatBox/api.ts b/components/SmartChatBox/api.ts index 6804d64..51d551f 100644 --- a/components/SmartChatBox/api.ts +++ b/components/SmartChatBox/api.ts @@ -75,6 +75,10 @@ function isShotVideoGeneration(data: any): data is ShotVideoGeneration { return data && 'prompt_json' in data && 'urls' in data && 'completed_count' in data && 'total_count' in data; } +function displayText(title: string, content: string, isLast: boolean = false) { + return `${content ? `${title}: ${content}${isLast ? '' : '\n'}` : ''}` +} + /** * 系统消息转换为blocks数组 */ @@ -153,7 +157,7 @@ function transformSystemMessage( if (isShotSketchGeneration(customData)) { blocks = [{ type: 'text', - text: `🎬 Storyboard static frame generation \nShot type: ${customData.shot_type}\nAtmosphere: ${customData.atmosphere}\nKey action: ${customData.key_action}` + text: `🎬 Storyboard static frame generation \n${displayText('Shot type', customData.shot_type)}${displayText('Atmosphere', customData.atmosphere)}${displayText('Key action', customData.key_action, true)}` }, { type: 'image', url: customData.url diff --git a/components/pages/work-flow/use-workflow-data.tsx b/components/pages/work-flow/use-workflow-data.tsx index 0305917..470ca09 100644 --- a/components/pages/work-flow/use-workflow-data.tsx +++ b/components/pages/work-flow/use-workflow-data.tsx @@ -115,24 +115,24 @@ export function useWorkflowData() { } }, [taskObject.currentStage]); - const generateEditPlan = useCallback(async (isInit?: boolean) => { - if (isLoaded) { - return; - } - localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true'); - isInit && await getGenerateEditPlan({ project_id: episodeId }); - openEditPlan(); - }, [episodeId]); + // const generateEditPlan = useCallback(async (isInit?: boolean) => { + // if (isLoaded) { + // return; + // } + // localStorage.setItem(`isLoaded_plan_${episodeId}`, 'true'); + // isInit && await getGenerateEditPlan({ project_id: episodeId }); + // openEditPlan(); + // }, [episodeId]); const openEditPlan = useCallback(async () => { window.open(`https://smartcut.movieflow.ai/ai-editor/${episodeId}?token=${token}&user_id=${useid}`, '_target'); }, [episodeId]); - useEffect(() => { - if (!from && canGoToCut && taskObject.status !== 'COMPLETED') { - generateEditPlan(true); - } - }, [canGoToCut, taskObject.status]); + // useEffect(() => { + // if (!from && canGoToCut && taskObject.status !== 'COMPLETED') { + // generateEditPlan(true); + // } + // }, [canGoToCut, taskObject.status]); useUpdateEffect(() => { @@ -407,8 +407,8 @@ export function useWorkflowData() { const titleResponse = await getScriptTitle({ project_id: episodeId }); console.log('titleResponse', titleResponse); if (titleResponse.successful) { - taskCurrent.title = titleResponse.data.title; - taskCurrent.tags = titleResponse.data.tags || []; + taskCurrent.title = titleResponse.data.name; + taskCurrent.tags = titleResponse.data.description.tags || []; } }