This commit is contained in:
小帅 2026-04-02 20:09:49 +08:00
commit e9d8b17423
4 changed files with 12 additions and 23 deletions

View File

@ -38,7 +38,7 @@ export default router.post(
filePath: new URL(src).pathname,
trackId,
videoDesc,
shouldGenerateImage,
shouldGenerateImage: src ? 1 : 0,
scriptId: scriptId,
projectId: projectId,
});

View File

@ -33,7 +33,9 @@ export default router.post(
if (!storyboardIds || storyboardIds.length === 0) return res.status(400).send(error("storyboardIds不能为空"));
// 当没有 storyboardIds 时,通过 AI 生成新的分镜面板数据
let finalStoryboardIds: number[] = storyboardIds || [];
await u.db("o_storyboard").whereIn("id", finalStoryboardIds).where("scriptId", scriptId).update({ state: "生成中" });
// shouldGenerateImage === 0 的分镜标记为「未生成」,其余标记为「生成中」
await u.db("o_storyboard").whereIn("id", finalStoryboardIds).where("scriptId", scriptId).where("shouldGenerateImage", 0).update({ state: "未生成" });
await u.db("o_storyboard").whereIn("id", finalStoryboardIds).where("scriptId", scriptId).whereNot("shouldGenerateImage", 0).update({ state: "生成中" });
const projectSettingData = await u.db("o_project").where("id", projectId).select("imageModel", "imageQuality", "artStyle").first();
@ -61,6 +63,8 @@ export default router.post(
associateAssetsIds: assetRecord[i.id!],
src: null,
state: i.state,
videoDesc: i.videoDesc,
shouldGenerateImage: i.shouldGenerateImage,
})),
),
);
@ -103,9 +107,10 @@ export default router.post(
});
};
// 按 concurrentCount 控制并发数,分批执行
for (let i = 0; i < storyboardData.length; i += concurrentCount) {
const batch = storyboardData.slice(i, i + concurrentCount);
// 按 concurrentCount 控制并发数,分批执行;跳过 shouldGenerateImage === 0 的分镜
const generateList = storyboardData.filter((item) => item.shouldGenerateImage !== 0);
for (let i = 0; i < generateList.length; i += concurrentCount) {
const batch = generateList.slice(i, i + concurrentCount);
await Promise.all(batch.map(generateTask));
}
},

View File

@ -22,6 +22,7 @@ export default router.post(
filePath: new URL(url).pathname,
flowId,
state: "已完成",
shouldGenerateImage:url ? 1 : 0
});
res.status(200).send(success({ message: "更新分镜成功" }));
},

View File

@ -1,21 +1,6 @@
// @db-hash 35cf00f711e9d4df398703de70511684
// @db-hash 7af86e2bafe5cab7d175eb68cf76ed7a
//该文件由脚本自动生成,请勿手动修改
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;
@ -301,7 +285,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;