修复bug

This commit is contained in:
zhishi 2026-04-03 04:39:58 +08:00
parent db8208d5b2
commit 1de3357155
2 changed files with 12 additions and 22 deletions

View File

@ -27,7 +27,7 @@ export default router.post(
.db("o_assets")
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
.whereIn("o_assets.id", parentIds as number[])
.select("o_assets.id", "o_image.filePath");
.select("o_assets.id", "o_image.filePath", "o_assets.describe");
const assetsSrcArr = await Promise.all(
parentAssetsData.map(async (item) => {
return {
@ -36,6 +36,12 @@ export default router.post(
};
}),
);
assetsDataArr.forEach((i: any) => {
const parent = parentAssetsData.find((item) => item.id === i.assetsId);
if (parent) {
i.parentDescribe = parent.describe;
}
});
const imageUrlRecord: Record<number, string> = {};
assetsSrcArr.forEach((item) => {
imageUrlRecord[item.id] = item.src;
@ -70,7 +76,7 @@ export default router.post(
const imageData: { id: number; state: string; src: string }[] = [];
res.status(200).send(success("开始生成资产图片"));
const generateSingleAsset = async (item: (typeof assetsDataArr)[number]) => {
const generateSingleAsset = async (item: any) => {
const imageId = imageIdMap[item.id!];
const typeConfig = promptRecord[item.type!] || promptRecord["role"];
@ -79,7 +85,9 @@ export default router.post(
messages: [
{
role: "user",
content: `资产描述: ${item.describe || "无详细描述"}`,
content: `
父级资产描述: ${item.parentDescribe || "无详细描述"}
当前资产描述: ${item.describe || "无详细描述"}`,
},
],
});

View File

@ -1,21 +1,6 @@
// @db-hash 35cf00f711e9d4df398703de70511684
// @db-hash e799af0c29da30dc4dbb46649b32bcaa
//该文件由脚本自动生成,请勿手动修改
export interface _o_project_old_20260402 {
'artStyle'?: string | null;
'createTime'?: number | null;
'id'?: number | null;
'imageModel'?: string | null;
'imageQuality'?: string | null;
'intro'?: string | null;
'mode'?: string | null;
'name'?: string | null;
'projectType'?: string | null;
'type'?: string | null;
'userId'?: number | null;
'videoModel'?: string | null;
'videoRatio'?: string | null;
}
export interface _o_storyboard_old_20260402 {
'createTime'?: number | null;
'duration'?: string | null;
@ -180,7 +165,6 @@ export interface o_outlineNovel {
export interface o_project {
'artStyle'?: string | null;
'createTime'?: number | null;
'directorManual'?: string | null;
'id'?: number | null;
'imageModel'?: string | null;
'imageQuality'?: string | null;
@ -271,7 +255,6 @@ export interface o_vendorConfig {
'createTime'?: number | null;
'description'?: string | null;
'enable'?: number | null;
'enableEnglish'?: number | null;
'icon'?: string | null;
'id'?: string;
'inputs'?: string | null;
@ -301,7 +284,6 @@ export interface o_videoTrack {
}
export interface DB {
"_o_project_old_20260402": _o_project_old_20260402;
"_o_storyboard_old_20260402": _o_storyboard_old_20260402;
"_o_storyboard_old_20260402_1": _o_storyboard_old_20260402_1;
"_o_vendorConfig_old_20260401": _o_vendorConfig_old_20260401;