# Conflicts:
#	src/types/database.d.ts
This commit is contained in:
zhishi 2026-03-31 22:31:20 +08:00
commit c146edaf69
7 changed files with 53 additions and 89 deletions

View File

@ -1,3 +1,10 @@
123
1212121212的王师傅水电费第三方水电费
1212121212
1212121212
121212
# # name121212第三方士大夫士大夫水电费第三方
# name121212
name name
123123水电费水电费水电费水电费水电费 123123水电费水电费水电费水电费水电费
12312312312 12312312312

View File

@ -33,10 +33,6 @@ export default router.post(
filePath: ending, filePath: ending,
type: "clip", 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表 // 查询o_video表
const videoRows = await u.db("o_video").where("state", "生成成功").andWhere("projectId", projectId).select("*"); 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) => ({ videoRows.map(async (row) => ({
id: row.id, id: row.id,
filePath: row.filePath ? await u.oss.getFileUrl(row.filePath) : "", filePath: row.filePath ? await u.oss.getFileUrl(row.filePath) : "",
selected: selectedIds.has(row.id), videoTrackId: row.videoTrackId,
videoParametersId: row.videoParametersId,
})), })),
); );

View File

@ -89,8 +89,6 @@ export default router.post(
scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景", visualManual: "art_scene" }, scene: { promptKey: "scene-polish", itemType: "scenes", label: "场景图", nameLabel: "场景", visualManual: "art_scene" },
tool: { promptKey: "tool-polish", itemType: "props", label: "道具图", nameLabel: "道具", visualManual: "art_prop" }, 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 状态为生成中 // 批量更新所有 item 状态为生成中
const assetsIds = items.map((item: { assetsId: number }) => item.assetsId); const assetsIds = items.map((item: { assetsId: number }) => item.assetsId);
await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" }); await u.db("o_assets").whereIn("id", assetsIds).update({ promptState: "生成中" });

View File

@ -13,6 +13,7 @@ export default router.post(
validateFields({ validateFields({
name: z.string(), name: z.string(),
images: z.array(z.string()), images: z.array(z.string()),
stylePath: z.string(),
data: z.array( data: z.array(
z.object({ z.object({
label: z.string(), label: z.string(),
@ -23,18 +24,19 @@ export default router.post(
}), }),
async (req, res) => { async (req, res) => {
try { try {
const { name, images, data } = req.body as { const { name, images, data, stylePath } = req.body as {
name: string; name: string;
images: string[]; images: string[];
data: { label: string; value: string; data: string }[]; data: { label: string; value: string; data: string }[];
stylePath: string;
}; };
if (/^\d+$/.test(name)) { if (/^\d+$/.test(stylePath)) {
res.status(400).send(error("名称不能为纯数字")); res.status(400).send(error("文件名称不能为纯数字"));
return; return;
} }
const mainPath = u.getPath(["skills", "art_prompts", name]); const mainPath = u.getPath(["skills", "art_prompts", stylePath]);
if (fs.existsSync(mainPath)) { if (fs.existsSync(mainPath)) {
return res.status(400).send(error("请勿填写重复名称的视觉手册")); return res.status(400).send(error("请勿填写重复名称的视觉手册"));
} }
@ -74,7 +76,7 @@ export default router.post(
} }
fs.writeFileSync(filePath, item.data, "utf-8"); fs.writeFileSync(filePath, item.data, "utf-8");
} }
const ossImagesDir = u.getPath(["oss", name]); const ossImagesDir = u.getPath(["oss", stylePath]);
let existingFiles: string[] = []; let existingFiles: string[] = [];
try { try {
@ -86,12 +88,12 @@ export default router.post(
for (const file of existingFiles) { for (const file of existingFiles) {
if (!retainedFileNames.has(file)) { if (!retainedFileNames.has(file)) {
await u.oss.deleteFile(`${name}/${file}`); await u.oss.deleteFile(`${stylePath}/${file}`);
} }
} }
for (const item of images) { 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()); res.status(200).send(success());

View File

@ -12,7 +12,7 @@ export default router.post(
"/", "/",
validateFields({ validateFields({
name: z.string(), name: z.string(),
title: z.string(), stylePath: z.string(),
images: z.array(z.string()), images: z.array(z.string()),
data: z.array( data: z.array(
z.object({ z.object({
@ -24,19 +24,19 @@ export default router.post(
}), }),
async (req, res) => { async (req, res) => {
try { try {
const { name, title, images, data } = req.body as { const { name, stylePath, images, data } = req.body as {
name: string; name: string;
title: string; stylePath: string;
images: string[]; images: string[];
data: { label: string; value: string; data: string }[]; data: { label: string; value: string; data: string }[];
}; };
if (/^\d+$/.test(name)) { if (/^\d+$/.test(stylePath)) {
res.status(400).send(error("名称不能为纯数字")); res.status(400).send(error("名称不能为纯数字"));
return; return;
} }
const mainPath = u.getPath(["skills", "art_prompts", name]); const mainPath = u.getPath(["skills", "art_prompts", stylePath]);
if (!fs.existsSync(mainPath)) { if (!fs.existsSync(mainPath)) {
return res.status(400).send(error("视觉手册不存在")); return res.status(400).send(error("视觉手册不存在"));
} }
@ -74,10 +74,10 @@ export default router.post(
if (!fs.existsSync(fileDir)) { if (!fs.existsSync(fileDir)) {
fs.mkdirSync(fileDir, { recursive: true }); 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"); fs.writeFileSync(filePath, content, "utf-8");
} }
const ossImagesDir = u.getPath(["oss", name]); const ossImagesDir = u.getPath(["oss", stylePath]);
let existingFiles: string[] = []; let existingFiles: string[] = [];
try { try {
@ -89,12 +89,12 @@ export default router.post(
for (const file of existingFiles) { for (const file of existingFiles) {
if (!retainedFileNames.has(file)) { if (!retainedFileNames.has(file)) {
await u.oss.deleteFile(`${name}/${file}`); await u.oss.deleteFile(`${stylePath}/${file}`);
} }
} }
for (const item of images) { 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()); res.status(200).send(success());

View File

@ -65,7 +65,6 @@ export default router.post("/", async (req, res) => {
const readmePath = path.join(styleDir, "README.md"); const readmePath = path.join(styleDir, "README.md");
const readmeContent = fs.readFileSync(readmePath, "utf-8"); const readmeContent = fs.readFileSync(readmePath, "utf-8");
const firstLine = readmeContent.split("\n")[0].replace(/--/g, ""); const firstLine = readmeContent.split("\n")[0].replace(/--/g, "");
const stylePath = path.join("askills", "art_prompts", styleName);
const data = DATA_MAP.map(({ label, value, subDir }) => { const data = DATA_MAP.map(({ label, value, subDir }) => {
let mdPath: string; let mdPath: string;
if (subDir) { if (subDir) {
@ -83,7 +82,7 @@ export default router.post("/", async (req, res) => {
return { return {
name: firstLine, name: firstLine,
image: images, image: images,
stylePath, stylePath: styleName,
data, data,
}; };
}), }),

View File

@ -1,48 +1,19 @@
// @db-hash c145f43374602285beea82bbd51eaec8 // @db-hash b1210691844e077e9df7dc16c802ce5a
//该文件由脚本自动生成,请勿手动修改 //该文件由脚本自动生成,请勿手动修改
export interface _o_storyboard_old_20260331 { export interface _o_project_old_20260331 {
'camera'?: string | null; 'artStyle'?: string | null;
'createTime'?: number | null; 'createTime'?: number | null;
'description'?: string | null; 'id'?: number | null;
'duration'?: string | null; 'imageModel'?: string | null;
'filePath'?: string | null; 'imageQuality'?: string | null;
'frameMode'?: string | null; 'intro'?: string | null;
'id'?: number; 'name'?: string | null;
'index'?: number | null; 'projectType'?: string | null;
'lines'?: string | null; 'type'?: string | null;
'mode'?: string | null; 'userId'?: number | null;
'model'?: string | null; 'videoModel'?: string | null;
'prompt'?: string | null; 'videoRatio'?: string | null;
'reason'?: string | null;
'resolution'?: string | null;
'scriptId'?: number | null;
'sound'?: string | null;
'state'?: string | null;
'title'?: string | null;
'videoPrompt'?: string | null;
}
export interface _o_storyboard_old_20260331_1 {
'camera'?: string | null;
'createTime'?: number | null;
'description'?: string | null;
'duration'?: string | null;
'filePath'?: string | null;
'frameMode'?: string | null;
'id'?: number;
'index'?: number | null;
'lines'?: string | null;
'mode'?: string | null;
'model'?: string | null;
'prompt'?: string | null;
'reason'?: string | null;
'resolution'?: string | null;
'scriptId'?: number | null;
'sound'?: string | null;
'state'?: string | null;
'title'?: string | null;
'track'?: string | null;
'videoPrompt'?: string | null;
} }
export interface memories { export interface memories {
'content': string; 'content': string;
@ -116,7 +87,6 @@ export interface o_image {
'filePath'?: string | null; 'filePath'?: string | null;
'id'?: number; 'id'?: number;
'model'?: string | null; 'model'?: string | null;
'reason'?: string | null;
'resolution'?: string | null; 'resolution'?: string | null;
'state'?: string | null; 'state'?: string | null;
'type'?: string | null; 'type'?: string | null;
@ -157,6 +127,7 @@ export interface o_project {
'imageModel'?: string | null; 'imageModel'?: string | null;
'imageQuality'?: string | null; 'imageQuality'?: string | null;
'intro'?: string | null; 'intro'?: string | null;
'mode'?: string | null;
'name'?: string | null; 'name'?: string | null;
'projectType'?: string | null; 'projectType'?: string | null;
'type'?: string | null; 'type'?: string | null;
@ -204,17 +175,25 @@ export interface o_skillList {
'updateTime': number; 'updateTime': number;
} }
export interface o_storyboard { export interface o_storyboard {
'camera'?: string | null;
'createTime'?: number | null; 'createTime'?: number | null;
'description'?: string | null;
'duration'?: string | null; 'duration'?: string | null;
'filePath'?: string | null; 'filePath'?: string | null;
'frameMode'?: string | null;
'id'?: number; 'id'?: number;
'index'?: number | null; 'index'?: number | null;
'projectId'?: number | null; 'lines'?: string | null;
'mode'?: string | null;
'model'?: string | null;
'prompt'?: string | null; 'prompt'?: string | null;
'reason'?: string | null; 'reason'?: string | null;
'resolution'?: string | null;
'scriptId'?: number | null; 'scriptId'?: number | null;
'sound'?: string | null;
'state'?: string | null; 'state'?: string | null;
'trackId'?: number | null; 'title'?: string | null;
'videoPrompt'?: string | null;
} }
export interface o_tasks { export interface o_tasks {
'describe'?: string | null; 'describe'?: string | null;
@ -251,22 +230,8 @@ export interface o_video {
'projectId'?: number | null; 'projectId'?: number | null;
'scriptId'?: number | null; 'scriptId'?: number | null;
'state'?: string | null; 'state'?: string | null;
'storyboardId'?: number | null;
'time'?: number | null; 'time'?: number | null;
} 'videoTrackId'?: number | null;
export interface o_videoConfig {
'audio'?: number | null;
'createTime'?: number | null;
'data'?: string | null;
'duration'?: number | null;
'id'?: number;
'mode'?: string | null;
'model'?: string | null;
'prompt'?: string | null;
'resolution'?: string | null;
'storyboardId'?: number | null;
'updateTime'?: number | null;
'videoId'?: number | null;
} }
export interface o_videoTrack { export interface o_videoTrack {
'id'?: number; 'id'?: number;
@ -276,8 +241,7 @@ export interface o_videoTrack {
} }
export interface DB { export interface DB {
"_o_storyboard_old_20260331": _o_storyboard_old_20260331; "_o_project_old_20260331": _o_project_old_20260331;
"_o_storyboard_old_20260331_1": _o_storyboard_old_20260331_1;
"memories": memories; "memories": memories;
"o_agentDeploy": o_agentDeploy; "o_agentDeploy": o_agentDeploy;
"o_agentWorkData": o_agentWorkData; "o_agentWorkData": o_agentWorkData;
@ -303,6 +267,5 @@ export interface DB {
"o_user": o_user; "o_user": o_user;
"o_vendorConfig": o_vendorConfig; "o_vendorConfig": o_vendorConfig;
"o_video": o_video; "o_video": o_video;
"o_videoConfig": o_videoConfig;
"o_videoTrack": o_videoTrack; "o_videoTrack": o_videoTrack;
} }