Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
This commit is contained in:
commit
5dd533e563
@ -55,6 +55,7 @@
|
|||||||
"express-ws": "^5.0.2",
|
"express-ws": "^5.0.2",
|
||||||
"fast-glob": "^3.3.3",
|
"fast-glob": "^3.3.3",
|
||||||
"form-data": "^4.0.5",
|
"form-data": "^4.0.5",
|
||||||
|
"graphlib": "^2.1.8",
|
||||||
"is-path-inside": "^4.0.0",
|
"is-path-inside": "^4.0.0",
|
||||||
"js-md5": "^0.8.3",
|
"js-md5": "^0.8.3",
|
||||||
"jsonwebtoken": "^9.0.3",
|
"jsonwebtoken": "^9.0.3",
|
||||||
|
|||||||
@ -307,7 +307,12 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
name: "o_storyboard",
|
name: "o_storyboard",
|
||||||
builder: (table) => {
|
builder: (table) => {
|
||||||
table.integer("id").notNullable();
|
table.integer("id").notNullable();
|
||||||
table.string("name");
|
table.text("name");
|
||||||
|
table.text("detail");
|
||||||
|
table.text("prompt");
|
||||||
|
table.text("seconds");
|
||||||
|
table.text("filePath");
|
||||||
|
table.text("frameType");
|
||||||
table.integer("createTime");
|
table.integer("createTime");
|
||||||
table.primary(["id"]);
|
table.primary(["id"]);
|
||||||
table.unique(["id"]);
|
table.unique(["id"]);
|
||||||
@ -414,6 +419,17 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
table.index(["isolationKey", "summarized"]);
|
table.index(["isolationKey", "summarized"]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
//分镜工作流表
|
||||||
|
{
|
||||||
|
name: "o_storyboardFlow",
|
||||||
|
builder: (table) => {
|
||||||
|
table.integer("id").notNullable();
|
||||||
|
table.text("flowData").notNullable();
|
||||||
|
table.integer("stroryboardId").notNullable();
|
||||||
|
table.primary(["id"]);
|
||||||
|
table.unique(["id"]);
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const t of tables) {
|
for (const t of tables) {
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
import express from "express";
|
||||||
|
import u from "@/utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { success } from "@/lib/responseFormat";
|
||||||
|
import { validateFields } from "@/middleware/middleware";
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
export default router.post(
|
||||||
|
"/",
|
||||||
|
validateFields({
|
||||||
|
model: z.string(),
|
||||||
|
references: z.array(z.string()).optional(),
|
||||||
|
quality: z.string(),
|
||||||
|
ratio: z.string(),
|
||||||
|
prompt: z.string(),
|
||||||
|
projectId: z.number(),
|
||||||
|
}),
|
||||||
|
async (req, res) => {
|
||||||
|
const { model, references = [], quality, ratio, prompt, projectId } = req.body;
|
||||||
|
const imageClass = await u.Ai.Image(model).run({
|
||||||
|
prompt: prompt,
|
||||||
|
imageBase64: references,
|
||||||
|
size: quality,
|
||||||
|
aspectRatio: ratio,
|
||||||
|
taskClass: "分镜生成",
|
||||||
|
describe: "生成分镜图片",
|
||||||
|
relatedObjects: JSON.stringify(req.body),
|
||||||
|
projectId: projectId,
|
||||||
|
});
|
||||||
|
const savePath = `${projectId}/storyboard/${u.uuid()}.jpg`;
|
||||||
|
await imageClass.save(savePath);
|
||||||
|
|
||||||
|
const url = await u.oss.getFileUrl(savePath);
|
||||||
|
const [imageId] = await u.db("o_image").insert({
|
||||||
|
filePath: savePath,
|
||||||
|
state: "1",
|
||||||
|
type: "storyFlow",
|
||||||
|
});
|
||||||
|
return res.status(200).send(success({ imageId, url }));
|
||||||
|
},
|
||||||
|
);
|
||||||
27
src/routes/production/editStoryboard/getStoryboardFlow.ts
Normal file
27
src/routes/production/editStoryboard/getStoryboardFlow.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import express from "express";
|
||||||
|
import u from "@/utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { success } from "@/lib/responseFormat";
|
||||||
|
import { validateFields } from "@/middleware/middleware";
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
export default router.post(
|
||||||
|
"/",
|
||||||
|
validateFields({
|
||||||
|
id: z.number(),
|
||||||
|
}),
|
||||||
|
async (req, res) => {
|
||||||
|
const { id } = req.body;
|
||||||
|
console.log("%c Line:15 🥤 id", "background:#e41a6a", id);
|
||||||
|
const storyboardFlowData = await u.db("o_storyboardFlow").where("stroryboardId", id).first();
|
||||||
|
if (storyboardFlowData?.flowData) {
|
||||||
|
return res.status(200).send(success(JSON.parse(storyboardFlowData?.flowData)));
|
||||||
|
}
|
||||||
|
return res.status(200).send(
|
||||||
|
success({
|
||||||
|
nodes: [],
|
||||||
|
edges: [],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
28
src/routes/production/editStoryboard/saveStoryboardFlow.ts
Normal file
28
src/routes/production/editStoryboard/saveStoryboardFlow.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import express from "express";
|
||||||
|
import u from "@/utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { success } from "@/lib/responseFormat";
|
||||||
|
import { validateFields } from "@/middleware/middleware";
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
export default router.post(
|
||||||
|
"/",
|
||||||
|
validateFields({
|
||||||
|
edges: z.any(),
|
||||||
|
nodes: z.any(),
|
||||||
|
imageId: z.number(),
|
||||||
|
}),
|
||||||
|
async (req, res) => {
|
||||||
|
const { edges, nodes, imageId } = req.body;
|
||||||
|
// if
|
||||||
|
const [id] = await u.db("o_storyboad").insert({
|
||||||
|
imageId,
|
||||||
|
});
|
||||||
|
await u.db("o_storyboardFlow").insert({
|
||||||
|
id: 1,
|
||||||
|
stroryboardId: id,
|
||||||
|
flowData: JSON.stringify({ edges, nodes }),
|
||||||
|
});
|
||||||
|
return res.status(200).send(success());
|
||||||
|
},
|
||||||
|
);
|
||||||
28
src/routes/production/editStoryboard/updateStoryboardFlow.ts
Normal file
28
src/routes/production/editStoryboard/updateStoryboardFlow.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import express from "express";
|
||||||
|
import u from "@/utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { success } from "@/lib/responseFormat";
|
||||||
|
import { validateFields } from "@/middleware/middleware";
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
export default router.post(
|
||||||
|
"/",
|
||||||
|
validateFields({
|
||||||
|
edges: z.any(),
|
||||||
|
nodes: z.any(),
|
||||||
|
id: z.number(),
|
||||||
|
imageId: z.number(),
|
||||||
|
}),
|
||||||
|
async (req, res) => {
|
||||||
|
const { edges, nodes, id, imageId } = req.body;
|
||||||
|
// if
|
||||||
|
await u.db("o_storyboard").where("id", id).update({ imageId });
|
||||||
|
await u
|
||||||
|
.db("o_storyboardFlow")
|
||||||
|
.where("stroryboardId", id)
|
||||||
|
.update({
|
||||||
|
flowData: JSON.stringify({ edges, nodes }),
|
||||||
|
});
|
||||||
|
return res.status(200).send(success());
|
||||||
|
},
|
||||||
|
);
|
||||||
@ -2520,6 +2520,13 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11,
|
|||||||
resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
|
resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
|
||||||
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
|
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
|
||||||
|
|
||||||
|
graphlib@^2.1.8:
|
||||||
|
version "2.1.8"
|
||||||
|
resolved "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz#5761d414737870084c92ec7b5dbcb0592c9d35da"
|
||||||
|
integrity sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.17.15"
|
||||||
|
|
||||||
guid-typescript@^1.0.9:
|
guid-typescript@^1.0.9:
|
||||||
version "1.0.9"
|
version "1.0.9"
|
||||||
resolved "https://registry.npmmirror.com/guid-typescript/-/guid-typescript-1.0.9.tgz#e35f77003535b0297ea08548f5ace6adb1480ddc"
|
resolved "https://registry.npmmirror.com/guid-typescript/-/guid-typescript-1.0.9.tgz#e35f77003535b0297ea08548f5ace6adb1480ddc"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user