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); }); - - }); - + \ No newline at end of file diff --git a/dsLightRag/static/JiMeng/video_preview.html b/dsLightRag/static/JiMeng/video_preview.html new file mode 100644 index 00000000..81a745f1 --- /dev/null +++ b/dsLightRag/static/JiMeng/video_preview.html @@ -0,0 +1,300 @@ + + + + + + 三、视频预览 + + + +
+

三、视频预览

+ +
+
视频生成中,请稍候...
+
+
+
+
+
正在准备...
+
+ +
+ +
+ + +
+
+ + + + \ No newline at end of file