Commit 10610901 authored by 周成波's avatar 周成波

优化

parent fb5edeea
...@@ -28,7 +28,7 @@ const form = reactive({ ...@@ -28,7 +28,7 @@ const form = reactive({
const sd_prompt_prefix = default_data.sd_prompt_prefix; const sd_prompt_prefix = default_data.sd_prompt_prefix;
const sd_negative_prompt_prefix = default_data.sd_negative_prompt_prefix; const sd_negative_prompt_prefix = default_data.sd_negative_prompt_prefix;
const tyqw = {'api': 'tyqw', 'name':'通义千问'}; const tyqw = {'api': 'tyqw', 'name':'通义千问线上'};
const baichuan = {'api': 'langchain', 'name':'baichuan2-7b'}; const baichuan = {'api': 'langchain', 'name':'baichuan2-7b'};
const qwen = {'api': 'langchain', 'name':'Qwen-7B-Chat'}; const qwen = {'api': 'langchain', 'name':'Qwen-7B-Chat'};
...@@ -154,7 +154,7 @@ const onAdapt = async () => { ...@@ -154,7 +154,7 @@ const onAdapt = async () => {
"角色": "", "角色": "",
"角色关键词": "", "角色关键词": "",
"画面描述词": "", "画面描述词": "",
"本镜配图": "", "本镜配图": "src/assets/loading.gif",
"local_image_path": "", "local_image_path": "",
}); });
} }
...@@ -163,8 +163,9 @@ const onAdapt = async () => { ...@@ -163,8 +163,9 @@ const onAdapt = async () => {
async function processScenes() { async function processScenes() {
for (const item of form.adapt_result_json) { for (const item of form.adapt_result_json) {
await onAdaptOne(item); await onAdaptOne(item);
await delay(100); // await delay(100);
await onDrawOne(item); // await onDrawOne(item);
onDrawOne(item);
} }
} }
...@@ -207,18 +208,17 @@ const onAdaptOne = async (item: any) => { ...@@ -207,18 +208,17 @@ const onAdaptOne = async (item: any) => {
const keywords = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n" + adapt_restrict, tuili_llm); const keywords = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n" + adapt_restrict, tuili_llm);
// console.log(keywords) // console.log(keywords)
item.场景关键词 = keywords; item.场景关键词 = keywords;
const adapt_role_restrict = `
指令:
请理解这个故事,针对其中的这个场景:“${item.场景描述}”,从所有角色中选择本场景的角色,多个角色以逗号分隔。`;
const item_roles = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n所有角色:\n"+ form.all_roles +"\n" + adapt_role_restrict, tuili_llm);
// console.log(role_keywords)
if (form.chatgpt_answer_roles.length === 0) { if (form.chatgpt_answer_roles.length === 0) {
// 总角色为空 // 总角色为空
item.角色 = ''; item.角色 = '';
item.角色关键词 = ''; item.角色关键词 = '';
} else { } else {
// 总角色不为空 // 总角色不为空
const adapt_role_restrict = `
指令:
请理解这个故事,针对其中的这个场景:“${item.场景描述}”,从所有角色中选择本场景的角色,多个角色以逗号分隔。`;
const item_roles = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n所有角色:\n"+ form.all_roles +"\n" + adapt_role_restrict, tuili_llm);
// console.log(role_keywords)
item.角色 = item_roles; item.角色 = item_roles;
let role_kws = "" let role_kws = ""
const item_roles_arr = item_roles.split(/[,,]/); const item_roles_arr = item_roles.split(/[,,]/);
...@@ -254,6 +254,7 @@ const onDrawOne = async (item: any) => { ...@@ -254,6 +254,7 @@ const onDrawOne = async (item: any) => {
console.log(form.task_id) console.log(form.task_id)
} }
try { try {
item.本镜配图 = "src/assets/loading.gif";
let temp_prompt = "" let temp_prompt = ""
if (item.场景描述) {temp_prompt = temp_prompt + `场景描述为:${item.场景描述}\n`}; if (item.场景描述) {temp_prompt = temp_prompt + `场景描述为:${item.场景描述}\n`};
if (item.场景关键词) {temp_prompt = temp_prompt + `场景关键词为:${item.场景关键词}\n`}; if (item.场景关键词) {temp_prompt = temp_prompt + `场景关键词为:${item.场景关键词}\n`};
...@@ -286,6 +287,7 @@ const onDrawOne = async (item: any) => { ...@@ -286,6 +287,7 @@ const onDrawOne = async (item: any) => {
message: String(error), message: String(error),
type: "error", type: "error",
}); });
item.本镜配图 = ""
} }
}; };
......
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