Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
# Conflicts: # src/types/database.d.ts
This commit is contained in:
commit
c146edaf69
@ -1,3 +1,10 @@
|
||||
123
|
||||
1212121212的王师傅水电费第三方水电费
|
||||
1212121212
|
||||
1212121212
|
||||
121212
|
||||
# # name121212第三方士大夫士大夫水电费第三方
|
||||
# name121212
|
||||
name
|
||||
123123水电费水电费水电费水电费水电费
|
||||
12312312312
|
||||
|
||||
@ -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,
|
||||
})),
|
||||
);
|
||||
|
||||
|
||||
@ -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: "生成中" });
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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,
|
||||
};
|
||||
}),
|
||||
|
||||
89
src/types/database.d.ts
vendored
89
src/types/database.d.ts
vendored
@ -1,48 +1,19 @@
|
||||
// @db-hash c145f43374602285beea82bbd51eaec8
|
||||
// @db-hash b1210691844e077e9df7dc16c802ce5a
|
||||
//该文件由脚本自动生成,请勿手动修改
|
||||
|
||||
export interface _o_storyboard_old_20260331 {
|
||||
'camera'?: string | null;
|
||||
export interface _o_project_old_20260331 {
|
||||
'artStyle'?: 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;
|
||||
'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;
|
||||
'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;
|
||||
@ -116,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;
|
||||
@ -157,6 +127,7 @@ export interface o_project {
|
||||
'imageModel'?: string | null;
|
||||
'imageQuality'?: string | null;
|
||||
'intro'?: string | null;
|
||||
'mode'?: string | null;
|
||||
'name'?: string | null;
|
||||
'projectType'?: string | null;
|
||||
'type'?: string | null;
|
||||
@ -204,17 +175,25 @@ export interface o_skillList {
|
||||
'updateTime': number;
|
||||
}
|
||||
export interface o_storyboard {
|
||||
'camera'?: string | null;
|
||||
'createTime'?: number | null;
|
||||
'description'?: string | null;
|
||||
'duration'?: string | null;
|
||||
'filePath'?: string | null;
|
||||
'frameMode'?: string | null;
|
||||
'id'?: number;
|
||||
'index'?: number | null;
|
||||
'projectId'?: 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;
|
||||
'trackId'?: number | null;
|
||||
'title'?: string | null;
|
||||
'videoPrompt'?: string | null;
|
||||
}
|
||||
export interface o_tasks {
|
||||
'describe'?: string | null;
|
||||
@ -251,22 +230,8 @@ export interface o_video {
|
||||
'projectId'?: number | null;
|
||||
'scriptId'?: number | null;
|
||||
'state'?: string | null;
|
||||
'storyboardId'?: number | null;
|
||||
'time'?: 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;
|
||||
'videoTrackId'?: number | null;
|
||||
}
|
||||
export interface o_videoTrack {
|
||||
'id'?: number;
|
||||
@ -276,8 +241,7 @@ export interface o_videoTrack {
|
||||
}
|
||||
|
||||
export interface DB {
|
||||
"_o_storyboard_old_20260331": _o_storyboard_old_20260331;
|
||||
"_o_storyboard_old_20260331_1": _o_storyboard_old_20260331_1;
|
||||
"_o_project_old_20260331": _o_project_old_20260331;
|
||||
"memories": memories;
|
||||
"o_agentDeploy": o_agentDeploy;
|
||||
"o_agentWorkData": o_agentWorkData;
|
||||
@ -303,6 +267,5 @@ export interface DB {
|
||||
"o_user": o_user;
|
||||
"o_vendorConfig": o_vendorConfig;
|
||||
"o_video": o_video;
|
||||
"o_videoConfig": o_videoConfig;
|
||||
"o_videoTrack": o_videoTrack;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user