From 58cd2cbf7d594acb830769be1a1a4a997456df39 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Thu, 21 Aug 2025 10:21:28 +0800 Subject: [PATCH] 'commit' --- dsLightRag/static/JiMeng/image_preview.html | 70 +++-- dsLightRag/static/JiMeng/video_preview.html | 300 ++++++++++++++++++++ 2 files changed, 353 insertions(+), 17 deletions(-) create mode 100644 dsLightRag/static/JiMeng/video_preview.html diff --git a/dsLightRag/static/JiMeng/image_preview.html b/dsLightRag/static/JiMeng/image_preview.html index 072ed7a1..c5f3ea1d 100644 --- a/dsLightRag/static/JiMeng/image_preview.html +++ b/dsLightRag/static/JiMeng/image_preview.html @@ -193,6 +193,7 @@
@@ -335,24 +336,59 @@ }); }); - // 制作视频按钮 - const createVideoBtn = document.getElementById('createVideoBtn'); - createVideoBtn.addEventListener('click', function() { - // 显示遮罩动画 - mask.classList.add('active'); - maskText.textContent = '正在制作视频,请稍候...'; + // 制作视频按钮 + const createVideoBtn = document.getElementById('createVideoBtn'); + createVideoBtn.addEventListener('click', function() { + const fenjingtouContent = fenjingtouResult.querySelector('pre').textContent.trim(); + if (!fenjingtouContent) { + alert('请先生成分镜头脚本'); + return; + } + + // 显示遮罩动画 + mask.classList.add('active'); + maskText.textContent = '正在创建视频任务,请稍候...'; + + // 调用创建视频任务API + fetch('/api/jimeng/create_video_task', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + image_url: imageUrl, + prompt: fenjingtouContent + }) + }) + .then(response => { + if (!response.ok) { + throw new Error('网络响应异常'); + } + return response.json(); + }) + .then(data => { + // 隐藏遮罩动画 + mask.classList.remove('active'); + + if (data.code === 200) { + // 获取任务ID并跳转到视频预览页面 + const taskId = data.data.task_id; + sessionStorage.setItem('videoTaskId', taskId); + window.location.href = 'video_preview.html'; + } else { + alert('创建视频任务失败: ' + data.message); + } + }) + .catch(error => { + // 隐藏遮罩动画 + mask.classList.remove('active'); + + console.error('创建视频任务时出错:', error); + alert('创建视频任务时出错: ' + error.message); + }); + }); - // 模拟视频制作过程(2秒后完成) - setTimeout(function() { - // 隐藏遮罩动画 - mask.classList.remove('active'); - alert('视频制作成功!'); - // 这里可以添加视频播放或下载的逻辑 - // window.location.href = 'video_player.html'; - }, 2000); }); - - }); - +