diff --git a/src/lib/initDB.ts b/src/lib/initDB.ts index d4c10b8..952cb24 100644 --- a/src/lib/initDB.ts +++ b/src/lib/initDB.ts @@ -494,6 +494,7 @@ description: 专注于从剧本内容中提取所使用的资产(角色、场 table.text("sound"); table.text("lines"); table.text("state"); + table.text("group"); table.text("reason"); table.integer("index"); table.integer("createTime"); diff --git a/src/routes/project/editVisualManual.ts b/src/routes/project/editVisualManual.ts index 6171620..73ab372 100644 --- a/src/routes/project/editVisualManual.ts +++ b/src/routes/project/editVisualManual.ts @@ -12,6 +12,7 @@ export default router.post( "/", validateFields({ name: z.string(), + title: z.string(), images: z.array(z.string()), data: z.array( z.object({ @@ -23,8 +24,9 @@ export default router.post( }), async (req, res) => { try { - const { name, images, data } = req.body as { + const { name, title, images, data } = req.body as { name: string; + title: string; images: string[]; data: { label: string; value: string; data: string }[]; }; @@ -72,7 +74,8 @@ export default router.post( if (!fs.existsSync(fileDir)) { fs.mkdirSync(fileDir, { recursive: true }); } - fs.writeFileSync(filePath, item.data, "utf-8"); + const content = item.value === "README" ? `# ${title}\n${item.data}` : item.data; + fs.writeFileSync(filePath, content, "utf-8"); } const ossImagesDir = u.getPath(["oss", name]); diff --git a/src/routes/script/extractAssets.ts b/src/routes/script/extractAssets.ts index 09e0fa5..008e0af 100644 --- a/src/routes/script/extractAssets.ts +++ b/src/routes/script/extractAssets.ts @@ -205,7 +205,7 @@ export default router.post( try { const data = await u.db("o_prompt").where("type", "scriptAssetExtraction").first("data"); const existingHint = existingAssetsList - ? `\n\n【已有资产列表】:${existingAssetsList}\n对于已有资产,如果在剧本中出现,只需在 existingAssetRefs 中给出资产名称和对应的 scriptIds 数组即可,无需重复生成 prompt/desc/type。对于新发现的资产(不在已有列表中),请在 newAssets 中给出完整信息。` + ? `\n\n【已有资产列表】:${existingAssetsList}\n对于已有资产,如果在剧本中出现,只需在 existingAssetRefs 中给出资产名称和对应的 scriptIds 数组即可,无需重复生成 desc/type。对于新发现的资产(不在已有列表中),请在 newAssets 中给出完整信息。` : ""; const output = await intansce.invoke({