From db8208d5b296557028940fd0da9b0ccb3e596e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Fri, 3 Apr 2026 03:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E8=A7=89=E6=89=8B=E5=86=8C=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=A4=B1=E8=B4=A5=E5=B0=B1=E6=8A=A5=E9=94=99=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/assetsGenerate/batchPolishAssetsPrompt.ts | 9 ++++++--- src/routes/assetsGenerate/polishAssetsPrompt.ts | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts b/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts index 898f3b5..04db8ff 100644 --- a/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts +++ b/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts @@ -83,13 +83,13 @@ export default router.post( }); }); const result: ResultItem[] = Object.values(itemMap); - // 批量更新所有 item 状态为生成中 const assetsIds = items.map((item: { assetsId: number }) => item.assetsId); - await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" }); //查询所有资产,用于判断每个资产是否是衍生资产 const assetsDataList = await u.db("o_assets").whereIn("id", assetsIds).select("id", "assetsId"); if (!assetsDataList || assetsDataList.length === 0) return res.status(500).send(error("资产不存在")); const assetsDataMap = new Map(assetsDataList.map((a: any) => [a.id, a])); + // 所有前置检测通过后,再批量更新状态为生成中 + await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" }); const getTypeConfig = ( isDerivative: boolean, @@ -128,7 +128,10 @@ export default router.post( if (!config) return; //获取到视觉手册 const visualManual = await u.getArtPrompt(project.artStyle as string, "art_skills", config.visualManual); - if (!visualManual) return res.status(500).send(error("视觉手册未定义")); + if (!visualManual) { + await u.db("o_assets").where("id", item.assetsId).update({ promptState: "生成失败", promptErrorReason: "视觉手册未定义" }); + return; + } findItemByName(result, item.name, config.itemType); const systemPrompt = visualManual; try { diff --git a/src/routes/assetsGenerate/polishAssetsPrompt.ts b/src/routes/assetsGenerate/polishAssetsPrompt.ts index d03ee2b..e1914bb 100644 --- a/src/routes/assetsGenerate/polishAssetsPrompt.ts +++ b/src/routes/assetsGenerate/polishAssetsPrompt.ts @@ -108,8 +108,6 @@ export default router.post( if (!config.visualManual) return res.status(500).send(error("视觉手册未定义")); //获取到视觉手册 const visualManual = await u.getArtPrompt(project.artStyle as string, "art_skills", config.visualManual); - console.log("%c Line:111 🍬 visualManual", "background:#6ec1c2", visualManual); - return if (!visualManual) return res.status(500).send(error("视觉手册未定义")); findItemByName(result, name, config.itemType); const systemPrompt = visualManual;