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

bug

parent 7c2aebdc
...@@ -20,8 +20,8 @@ export default { ...@@ -20,8 +20,8 @@ export default {
} }
}) })
.catch((err: any) => { .catch((err: any) => {
console.log(err); console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与LLM通讯失败:${JSON.stringify(err.message.message)}`); return Promise.reject(`与LLM通讯失败:${JSON.stringify(err.message)}`);
}); });
}, },
...@@ -63,8 +63,8 @@ export default { ...@@ -63,8 +63,8 @@ export default {
} }
}) })
.catch((err: any) => { .catch((err: any) => {
console.log(err); console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与 stable-diffusion-webui Api 通讯失败:${JSON.stringify(err.message.message)}`); return Promise.reject(`与 stable-diffusion-webui Api 通讯失败:${JSON.stringify(err.message)}`);
}); });
}, },
...@@ -84,8 +84,8 @@ export default { ...@@ -84,8 +84,8 @@ export default {
} }
}) })
.catch((err: any) => { .catch((err: any) => {
console.log(err); console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`gen_video接口通讯失败:${JSON.stringify(err.message.message)}`); return Promise.reject(`gen_video接口通讯失败:${JSON.stringify(err.message)}`);
}); });
}, },
...@@ -105,8 +105,8 @@ export default { ...@@ -105,8 +105,8 @@ export default {
} }
}) })
.catch((err: any) => { .catch((err: any) => {
console.log(err); console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与pwd_check接口通讯失败:${JSON.stringify(err.message.message)}`); return Promise.reject(`与pwd_check接口通讯失败:${JSON.stringify(err.message)}`);
}); });
}, },
...@@ -126,8 +126,8 @@ export default { ...@@ -126,8 +126,8 @@ export default {
} }
}) })
.catch((err: any) => { .catch((err: any) => {
console.log(err); console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与翻译接口通讯失败:${JSON.stringify(err.message.message)}`); return Promise.reject(`与翻译接口通讯失败:${JSON.stringify(err.message)}`);
}); });
}, },
} }
...@@ -87,28 +87,35 @@ const onAdaptRoles = async () => { ...@@ -87,28 +87,35 @@ const onAdaptRoles = async () => {
return; return;
} }
// 推理角色 // 推理角色
form.chatgpt_answer_roles = []; try {
const adapt_restrict = `请理解这个故事:“${form.chatgpt_answer}”,给出这个故事中的所有角色,多个角色以逗号分隔。\n要求:只返回角色名称即可,不要添加其他的内容。`; form.chatgpt_answer_roles = [];
let roles = await text2videoService.submitLLM(adapt_restrict, role_llm.api); const adapt_restrict = `请理解这个故事:“${form.chatgpt_answer}”,给出这个故事中的所有角色,多个角色以逗号分隔。\n要求:只返回角色名称即可,不要添加其他的内容。`;
form.all_roles = roles.replace(/。|(|)/g, '').replace(/、/g, ','); let roles = await text2videoService.submitLLM(adapt_restrict, role_llm.api);
console.log(form.all_roles); form.all_roles = roles.replace(/。|(|)/g, '').replace(/、/g, ',');
const roles_arr = form.all_roles.split(/[,,]/); console.log(form.all_roles);
console.log(roles_arr); const roles_arr = form.all_roles.split(/[,,]/);
// 推理属性 console.log(roles_arr);
const attribute_options = default_data.role_attribute_options.map(option => option.value); // 推理属性
for (const one_role of roles_arr) { const attribute_options = default_data.role_attribute_options.map(option => option.value);
// const adapt_attribute_restrict = `根据这个故事:“${form.chatgpt_answer}”,你认为这个角色:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`; for (const one_role of roles_arr) {
// const adapt_attribute_restrict = `你认为这个角色:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`; // const adapt_attribute_restrict = `根据这个故事:“${form.chatgpt_answer}”,你认为这个角色:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`;
const adapt_attribute_restrict = `故事全文:“${form.chatgpt_answer}”,请理解故事全文,然后判断:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`; // const adapt_attribute_restrict = `你认为这个角色:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`;
let attribute = await text2videoService.submitLLM(adapt_attribute_restrict, role_keywords_llm.api); const adapt_attribute_restrict = `故事全文:“${form.chatgpt_answer}”,请理解故事全文,然后判断:“${one_role}”是“${String(attribute_options)}”中的哪一种?请返回选择的结果。\n要求:只返回选择的结果即可,不要添加其他的内容。`;
form.chatgpt_answer_roles.push({ let attribute = await text2videoService.submitLLM(adapt_attribute_restrict, role_keywords_llm.api);
"角色": one_role.trim(), form.chatgpt_answer_roles.push({
"角色关键词": "", "角色": one_role.trim(),
"角色关键词英文": "", "角色关键词": "",
"属性": attribute, "角色关键词英文": "",
"属性": attribute,
});
}
console.log(form.chatgpt_answer_roles)
} catch (error) {
ElMessage({
message: String(error),
type: "error",
}); });
} }
console.log(form.chatgpt_answer_roles)
}; };
...@@ -681,7 +688,6 @@ const onPwdCheckDialog = () => { ...@@ -681,7 +688,6 @@ const onPwdCheckDialog = () => {
type: "error", type: "error",
}); });
}); });
} }
const onDeleteOne = (item: any) => { const onDeleteOne = (item: any) => {
......
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