Commit 1423d428 authored by 周成波's avatar 周成波

bug修复

parent 1f769e0a
...@@ -67,7 +67,7 @@ export const useManyValues = () => { ...@@ -67,7 +67,7 @@ export const useManyValues = () => {
const vertical_data = { const vertical_data = {
task_id: "20240220181602687", task_id: "20240220181602687",
chatgpt_prompt: `生成一个50字的科幻小故事,阿凡达系列`, chatgpt_prompt: `生成一个50字的科幻小故事,阿凡达系列`,
chatgpt_answer: `在奇幻的熊猫王国,阿宝——不再是功夫大师,而化身为西游世界里的神秘旅者。一日,阿宝巧遇唐僧师徒四人,他们正被一只诡异黑影困扰,经书被盗,疑云密布。`, chatgpt_answer: `"嘿,你绝对猜不到!一只松鼠竟敢挑战国宝熊猫,就为了争夺一块蛋糕!" 在宁静的森林里,一场奇特的食物大战正在上演。一只机灵的小松鼠,眼尖地发现了一块香气扑鼻的奶油蛋糕,正惬意地躺在熊猫阿宝的竹篮里。蛋糕上的水果点缀和醇厚的奶油似乎在向小松鼠招手,它的口水都快流成一条小溪了。 而慵懒的大熊猫阿宝,本打算用这块蛋糕作为午后小憩的甜点,却没料到这位“飞檐走壁”的小贼会来挑战他的权威。只见松鼠灵活地穿梭在树枝间,伺机抢夺那块诱人的蛋糕,而熊猫阿宝则憨态可掬地试图守护这份甜蜜。 于是乎,一场别开生面的蛋糕争夺战就此展开,松鼠施展浑身解数,上蹿下跳,熊猫阿宝也不甘示弱,笨拙中透着狡黠,场面既紧张又逗趣。这场较量究竟谁能胜出?是身手矫健的小松鼠,还是憨萌可爱的熊猫阿宝?一切悬念,都围绕着那块美味的蛋糕徐徐展开……`,
chatgpt_answer_roles: [], chatgpt_answer_roles: [],
adapt_result_json: [], adapt_result_json: [],
final_video: ``, final_video: ``,
......
This diff is collapsed.
...@@ -210,6 +210,7 @@ const onAdapt = async () => { ...@@ -210,6 +210,7 @@ const onAdapt = async () => {
"画面描述词": "", "画面描述词": "",
"本镜配图": "src/assets/waiting.png", "本镜配图": "src/assets/waiting.png",
"local_image_path": "", "local_image_path": "",
"info": "",
}); });
} }
console.log(form.adapt_result_json) console.log(form.adapt_result_json)
...@@ -257,12 +258,13 @@ const onAdaptOneScene = async (item: any) => { ...@@ -257,12 +258,13 @@ const onAdaptOneScene = async (item: any) => {
return; return;
} }
// 推理场景 // 推理场景
// 人物(可以发挥想象进行补充,但一定要有), 暂时去掉
try { try {
const adapt_restrict = `故事:\n${form.chatgpt_answer}\n const adapt_restrict = `故事:\n${form.chatgpt_answer}\n
指令: 指令:
请理解这个故事,给出这个场景“${item.场景描述}”的关键词(年代(可以发挥想象进行补充,但一定要有),空间(可以发挥想象进行补充,但一定要有), 请理解这个故事,给出这个场景“${item.场景描述}”的关键词(年代(可以发挥想象进行补充,但一定要有),空间(可以发挥想象进行补充,但一定要有),
时间段(可以发挥想象进行补充,但一定要有),地理环境(可以发挥想象进行补充,但一定要有),天气(可以发挥想象进行补充,但一定要有), 时间段(可以发挥想象进行补充,但一定要有),地理环境(可以发挥想象进行补充,但一定要有),天气(可以发挥想象进行补充,但一定要有),
物品(可以发挥想象进行补充,但一定要有),人物(可以发挥想象进行补充,但一定要有),镜头角度(可以发挥想象进行补充,但一定要有))。 物品(可以发挥想象进行补充,但一定要有),镜头角度(可以发挥想象进行补充,但一定要有))。
要求: 要求:
关键词以逗号分隔。 关键词以逗号分隔。
只要返回关键词,不需要其他的说明文字。`; 只要返回关键词,不需要其他的说明文字。`;
...@@ -343,10 +345,12 @@ const onAdaptOneSceneRoles = async (item: any) => { ...@@ -343,10 +345,12 @@ const onAdaptOneSceneRoles = async (item: any) => {
} else { } else {
// 总角色不为空 // 总角色不为空
// const adapt_role_restrict = `请理解这个故事:“${form.chatgpt_answer}”,针对其中的这个场景:“${item.场景描述}”,从所有角色:“${form.all_roles}”中选择本场景的角色,多个角色以逗号分隔。`; // const adapt_role_restrict = `请理解这个故事:“${form.chatgpt_answer}”,针对其中的这个场景:“${item.场景描述}”,从所有角色:“${form.all_roles}”中选择本场景的角色,多个角色以逗号分隔。`;
const adapt_role_restrict = `整个故事(“${form.chatgpt_answer}),\n\n本章节(${item.场景描述}),\n\n角色列表(${form.all_roles}),\n\n你是程序员,请返回给本章节出现的角色,注意,不要发挥想象,必须从角色列表中选出本章节出现过的角色,如果多个用逗号隔开。`; const adapt_role_restrict = `整个故事(“${form.chatgpt_answer}),\n\n本章节(${item.场景描述}),\n\n角色列表(${form.all_roles}),\n\n请返回给本章节出现的角色。注意:不要发挥想象,必须从角色列表中选出本章节出现过的角色,如果多个用逗号隔开。`;
const item_roles = await text2videoService.submitLLM(adapt_role_restrict, tuili_keyword_llm.api); const item_roles = await text2videoService.submitLLM(adapt_role_restrict, tuili_keyword_llm.api);
console.log(`==============${item.编号}===============`)
// console.log(adapt_role_restrict) // console.log(adapt_role_restrict)
// console.log(item_roles) console.log(`推理返回:${item_roles}`)
item.info = `推理返回:${item_roles}`
item.角色 = item_roles.trim(); item.角色 = item_roles.trim();
////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【begin】 ////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【begin】
...@@ -356,7 +360,13 @@ const onAdaptOneSceneRoles = async (item: any) => { ...@@ -356,7 +360,13 @@ const onAdaptOneSceneRoles = async (item: any) => {
if(temp_arr_length > 1) { if(temp_arr_length > 1) {
////// 获取本镜之前的所有角色 ////// 获取本镜之前的所有角色
let role_history = ""; let role_history = "";
form.adapt_result_json.forEach( scene => { if (scene.编号 < item.编号) { role_history += scene.角色 + ","; } }) form.adapt_result_json.forEach( scene => {
if (Number(scene.编号) < Number(item.编号)) {
role_history += scene.角色 + ",";
}
})
role_history = role_history.replace(/,+$/, '');
console.log(`role_history = ${role_history}`)
for (const temp of temp_arr) { for (const temp of temp_arr) {
if (role_history.includes(temp)) { if (role_history.includes(temp)) {
item.角色 = ""; item.角色 = "";
...@@ -366,7 +376,7 @@ const onAdaptOneSceneRoles = async (item: any) => { ...@@ -366,7 +376,7 @@ const onAdaptOneSceneRoles = async (item: any) => {
break; break;
} }
} }
if (item.角色 == "") { if (!item.角色) {
const role_history_arr = role_history.split(','); const role_history_arr = role_history.split(',');
if (role_history_arr.length >= 2) { if (role_history_arr.length >= 2) {
item.角色 = role_history_arr[role_history_arr.length - 2]; item.角色 = role_history_arr[role_history_arr.length - 2];
...@@ -375,8 +385,10 @@ const onAdaptOneSceneRoles = async (item: any) => { ...@@ -375,8 +385,10 @@ const onAdaptOneSceneRoles = async (item: any) => {
} else { } else {
item.角色 = item_roles.trim(); item.角色 = item_roles.trim();
} }
console.log(`lalalalala item.角色 = ${item.角色}`)
} }
} }
console.log(`item.角色 = ${item.角色}`)
////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【end】 ////// 加一段逻辑,本镜角色有且只能有一个,且尽量不与之前相同。【end】
// 开始匹配角色关键词 // 开始匹配角色关键词
...@@ -776,9 +788,9 @@ const onDeleteOne = (item: any) => { ...@@ -776,9 +788,9 @@ const onDeleteOne = (item: any) => {
<el-text class="mx-1" size="small">{{ scope.row.场景关键词英文 }}</el-text> <el-text class="mx-1" size="small">{{ scope.row.场景关键词英文 }}</el-text>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="角色" label="角色" width="150" > <el-table-column prop="角色" label="角色">
<template v-slot="scope"> <template v-slot="scope">
<el-text class="mx-1" size="small">{{ scope.row.角色 }}</el-text> <el-text class="mx-1" size="small">{{ scope.row.角色 }}<br/>{{ scope.row.info }}</el-text>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="角色关键词" label="角色关键词"> <el-table-column prop="角色关键词" label="角色关键词">
......
...@@ -178,6 +178,7 @@ const onAdapt = async () => { ...@@ -178,6 +178,7 @@ const onAdapt = async () => {
"画面描述词": "", "画面描述词": "",
"本镜配图": "src/assets/loading.gif", "本镜配图": "src/assets/loading.gif",
"local_image_path": "", "local_image_path": "",
"info": "",
}); });
} }
console.log(form.adapt_result_json) console.log(form.adapt_result_json)
......
...@@ -10,6 +10,7 @@ declare namespace Wm { ...@@ -10,6 +10,7 @@ declare namespace Wm {
"画面描述词": string, "画面描述词": string,
"本镜配图": string, "本镜配图": string,
"local_image_path": string, "local_image_path": string,
"info": string,
} }
interface GenVideo { interface GenVideo {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment