From 76efd4fdf5d7391e63ea129f54207c5f8a5fef01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Tue, 31 Mar 2026 21:48:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E8=A7=89=E6=89=8B?= =?UTF-8?q?=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chinese_sweet_romance/README.md | 7 +++++++ src/routes/assets/getMaterialData.ts | 7 +------ .../assetsGenerate/batchPolishAssetsPrompt.ts | 2 -- src/routes/project/addVisualManual.ts | 16 +++++++++------- src/routes/project/deleteVisualManual.ts | 1 + src/routes/project/editVisualManual.ts | 18 +++++++++--------- src/routes/project/getVisualManual.ts | 3 +-- src/types/database.d.ts | 19 ++++++++++++++++--- 8 files changed, 44 insertions(+), 29 deletions(-) diff --git a/data/skills/art_prompts/chinese_sweet_romance/README.md b/data/skills/art_prompts/chinese_sweet_romance/README.md index 165cb0d..7c3c2c7 100644 --- a/data/skills/art_prompts/chinese_sweet_romance/README.md +++ b/data/skills/art_prompts/chinese_sweet_romance/README.md @@ -1,3 +1,10 @@ +123 +1212121212的王师傅水电费第三方水电费 +1212121212 +1212121212 +121212 +# # name121212第三方士大夫士大夫水电费第三方 +# name121212 name 123123水电费水电费水电费水电费水电费 12312312312 diff --git a/src/routes/assets/getMaterialData.ts b/src/routes/assets/getMaterialData.ts index d3c14cc..b3e5ebe 100644 --- a/src/routes/assets/getMaterialData.ts +++ b/src/routes/assets/getMaterialData.ts @@ -33,10 +33,6 @@ export default router.post( filePath: ending, type: "clip", }); - // 查询o_videoConfig表,拿到已选中的videoId - const configRows = await u.db("o_videoConfig").select("videoId"); - const selectedIds = new Set(configRows.map((row) => row.videoId)); - // 查询o_video表 const videoRows = await u.db("o_video").where("state", "生成成功").andWhere("projectId", projectId).select("*"); // 处理并返回结果 @@ -44,8 +40,7 @@ export default router.post( videoRows.map(async (row) => ({ id: row.id, filePath: row.filePath ? await u.oss.getFileUrl(row.filePath) : "", - selected: selectedIds.has(row.id), - videoParametersId: row.videoParametersId, + videoTrackId: row.videoTrackId, })), ); diff --git a/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts b/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts index 97adcf6..1738e99 100644 --- a/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts +++ b/src/routes/assetsGenerate/batchPolishAssetsPrompt.ts @@ -89,8 +89,6 @@ export default router.post( scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景", visualManual: "art_scene" }, tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具", visualManual: "art_prop" }, }; - const novelData = (await u.db("o_novel").whereIn("chapterIndex", [1]).select("*")) as NovelChapter[]; - const novelText = mergeNovelText(novelData); // 批量更新所有 item 状态为生成中 const assetsIds = items.map((item: { assetsId: number }) => item.assetsId); await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" }); diff --git a/src/routes/project/addVisualManual.ts b/src/routes/project/addVisualManual.ts index e25f6a6..434ed67 100644 --- a/src/routes/project/addVisualManual.ts +++ b/src/routes/project/addVisualManual.ts @@ -13,6 +13,7 @@ export default router.post( validateFields({ name: z.string(), images: z.array(z.string()), + stylePath: z.string(), data: z.array( z.object({ label: z.string(), @@ -23,18 +24,19 @@ export default router.post( }), async (req, res) => { try { - const { name, images, data } = req.body as { + const { name, images, data, stylePath } = req.body as { name: string; images: string[]; data: { label: string; value: string; data: string }[]; + stylePath: string; }; - if (/^\d+$/.test(name)) { - res.status(400).send(error("名称不能为纯数字")); + if (/^\d+$/.test(stylePath)) { + res.status(400).send(error("文件名称不能为纯数字")); return; } - const mainPath = u.getPath(["skills", "art_prompts", name]); + const mainPath = u.getPath(["skills", "art_prompts", stylePath]); if (fs.existsSync(mainPath)) { return res.status(400).send(error("请勿填写重复名称的视觉手册")); } @@ -74,7 +76,7 @@ export default router.post( } fs.writeFileSync(filePath, item.data, "utf-8"); } - const ossImagesDir = u.getPath(["oss", name]); + const ossImagesDir = u.getPath(["oss", stylePath]); let existingFiles: string[] = []; try { @@ -86,12 +88,12 @@ export default router.post( for (const file of existingFiles) { if (!retainedFileNames.has(file)) { - await u.oss.deleteFile(`${name}/${file}`); + await u.oss.deleteFile(`${stylePath}/${file}`); } } for (const item of images) { - if (!item.startsWith("http")) await u.oss.writeFile(`${name}/${u.uuid()}.jpg`, item); + if (!item.startsWith("http")) await u.oss.writeFile(`${stylePath}/${u.uuid()}.jpg`, item); } res.status(200).send(success()); diff --git a/src/routes/project/deleteVisualManual.ts b/src/routes/project/deleteVisualManual.ts index 5d35333..eeeb8c6 100644 --- a/src/routes/project/deleteVisualManual.ts +++ b/src/routes/project/deleteVisualManual.ts @@ -15,6 +15,7 @@ export default router.post( async (req, res) => { try { const { name } = req.body as { name: string }; + console.log("%c Line:18 🍓 name", "background:#2eafb0", name); // 安全校验:不允许包含路径分隔符、纯数字,防止越级删除或误删项目目录 if (name.includes("/") || name.includes("\\") || name === "." || name === ".." || /^\d+$/.test(name)) { diff --git a/src/routes/project/editVisualManual.ts b/src/routes/project/editVisualManual.ts index 73ab372..77c7ea3 100644 --- a/src/routes/project/editVisualManual.ts +++ b/src/routes/project/editVisualManual.ts @@ -12,7 +12,7 @@ export default router.post( "/", validateFields({ name: z.string(), - title: z.string(), + stylePath: z.string(), images: z.array(z.string()), data: z.array( z.object({ @@ -24,19 +24,19 @@ export default router.post( }), async (req, res) => { try { - const { name, title, images, data } = req.body as { + const { name, stylePath, images, data } = req.body as { name: string; - title: string; + stylePath: string; images: string[]; data: { label: string; value: string; data: string }[]; }; - if (/^\d+$/.test(name)) { + if (/^\d+$/.test(stylePath)) { res.status(400).send(error("名称不能为纯数字")); return; } - const mainPath = u.getPath(["skills", "art_prompts", name]); + const mainPath = u.getPath(["skills", "art_prompts", stylePath]); if (!fs.existsSync(mainPath)) { return res.status(400).send(error("视觉手册不存在")); } @@ -74,10 +74,10 @@ export default router.post( if (!fs.existsSync(fileDir)) { fs.mkdirSync(fileDir, { recursive: true }); } - const content = item.value === "README" ? `# ${title}\n${item.data}` : item.data; + const content = item.value === "README" ? `${name}\n${item.data}` : item.data; fs.writeFileSync(filePath, content, "utf-8"); } - const ossImagesDir = u.getPath(["oss", name]); + const ossImagesDir = u.getPath(["oss", stylePath]); let existingFiles: string[] = []; try { @@ -89,12 +89,12 @@ export default router.post( for (const file of existingFiles) { if (!retainedFileNames.has(file)) { - await u.oss.deleteFile(`${name}/${file}`); + await u.oss.deleteFile(`${stylePath}/${file}`); } } for (const item of images) { - if (!item.startsWith("http")) await u.oss.writeFile(`${name}/${u.uuid()}.jpg`, item); + if (!item.startsWith("http")) await u.oss.writeFile(`${stylePath}/${u.uuid()}.jpg`, item); } res.status(200).send(success()); diff --git a/src/routes/project/getVisualManual.ts b/src/routes/project/getVisualManual.ts index e617a25..e227418 100644 --- a/src/routes/project/getVisualManual.ts +++ b/src/routes/project/getVisualManual.ts @@ -65,7 +65,6 @@ export default router.post("/", async (req, res) => { const readmePath = path.join(styleDir, "README.md"); const readmeContent = fs.readFileSync(readmePath, "utf-8"); const firstLine = readmeContent.split("\n")[0].replace(/--/g, ""); - const stylePath = path.join("askills", "art_prompts", styleName); const data = DATA_MAP.map(({ label, value, subDir }) => { let mdPath: string; if (subDir) { @@ -83,7 +82,7 @@ export default router.post("/", async (req, res) => { return { name: firstLine, image: images, - stylePath, + stylePath: styleName, data, }; }), diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 6635502..9c19252 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,6 +1,20 @@ -// @db-hash c2029b55b7dcdcf64788dafc34799fea +// @db-hash b1210691844e077e9df7dc16c802ce5a //该文件由脚本自动生成,请勿手动修改 +export interface _o_project_old_20260331 { + 'artStyle'?: string | null; + 'createTime'?: number | null; + 'id'?: number | null; + 'imageModel'?: string | null; + 'imageQuality'?: string | null; + 'intro'?: string | null; + 'name'?: string | null; + 'projectType'?: string | null; + 'type'?: string | null; + 'userId'?: number | null; + 'videoModel'?: string | null; + 'videoRatio'?: string | null; +} export interface memories { 'content': string; 'createTime': number; @@ -73,7 +87,6 @@ export interface o_image { 'filePath'?: string | null; 'id'?: number; 'model'?: string | null; - 'reason'?: string | null; 'resolution'?: string | null; 'state'?: string | null; 'type'?: string | null; @@ -168,7 +181,6 @@ export interface o_storyboard { 'duration'?: string | null; 'filePath'?: string | null; 'frameMode'?: string | null; - 'group'?: string | null; 'id'?: number; 'index'?: number | null; 'lines'?: string | null; @@ -229,6 +241,7 @@ export interface o_videoTrack { } export interface DB { + "_o_project_old_20260331": _o_project_old_20260331; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData;