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
c3dd7ade64
@ -96,11 +96,6 @@ export default router.post(
|
|||||||
await imageClass.save(savePath);
|
await imageClass.save(savePath);
|
||||||
|
|
||||||
const url = await u.oss.getFileUrl(savePath);
|
const url = await u.oss.getFileUrl(savePath);
|
||||||
const [imageId] = await u.db("o_image").insert({
|
return res.status(200).send(success({ url }));
|
||||||
filePath: savePath,
|
|
||||||
state: "1",
|
|
||||||
type: "storyFlow",
|
|
||||||
});
|
|
||||||
return res.status(200).send(success({ imageId, url }));
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -15,13 +15,19 @@ export default router.post(
|
|||||||
console.log("%c Line:15 🥤 id", "background:#e41a6a", id);
|
console.log("%c Line:15 🥤 id", "background:#e41a6a", id);
|
||||||
const storyboardFlowData = await u.db("o_storyboardFlow").where("stroryboardId", id).first();
|
const storyboardFlowData = await u.db("o_storyboardFlow").where("stroryboardId", id).first();
|
||||||
if (storyboardFlowData?.flowData) {
|
if (storyboardFlowData?.flowData) {
|
||||||
return res.status(200).send(success(JSON.parse(storyboardFlowData?.flowData)));
|
const parseFlow = JSON.parse(storyboardFlowData.flowData);
|
||||||
|
await Promise.all(
|
||||||
|
parseFlow.nodes.map(async (node: any) => {
|
||||||
|
if (node.type === "upload") {
|
||||||
|
node.data.image = node.data.image ? await u.oss.getFileUrl(node.data.image) : "";
|
||||||
|
} else if (node.type === "generated") {
|
||||||
|
node.data.generatedImage = node.data.generatedImage ? await u.oss.getFileUrl(node.data.generatedImage) : "";
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return res.status(200).send(success(parseFlow));
|
||||||
}
|
}
|
||||||
return res.status(200).send(
|
|
||||||
success({
|
return res.status(200).send(success(null));
|
||||||
nodes: [],
|
|
||||||
edges: [],
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,15 +10,22 @@ export default router.post(
|
|||||||
validateFields({
|
validateFields({
|
||||||
edges: z.any(),
|
edges: z.any(),
|
||||||
nodes: z.any(),
|
nodes: z.any(),
|
||||||
imageUrl: z.number(),
|
imageUrl: z.string(),
|
||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { edges, nodes, imageUrl } = req.body;
|
const { edges, nodes, imageUrl } = req.body;
|
||||||
if (!imageUrl.includes("http")) {
|
if (!imageUrl.includes("http")) {
|
||||||
return res.status(400).send({ message: "图片地址不合法" });
|
return res.status(400).send({ message: "图片地址不合法" });
|
||||||
}
|
}
|
||||||
// if
|
nodes.forEach((node: any) => {
|
||||||
const [id] = await u.db("o_storyboad").insert({
|
if (node.type == "upload") {
|
||||||
|
node.data.image = node.data.image ? new URL(node.data.image).pathname : "";
|
||||||
|
}
|
||||||
|
if (node.type == "generated") {
|
||||||
|
node.data.generatedImage = node.data.generatedImage ? new URL(node.data.generatedImage).pathname : "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const [id] = await u.db("o_storyboard").insert({
|
||||||
filePath: new URL(imageUrl).pathname,
|
filePath: new URL(imageUrl).pathname,
|
||||||
});
|
});
|
||||||
await u.db("o_storyboardFlow").insert({
|
await u.db("o_storyboardFlow").insert({
|
||||||
|
|||||||
@ -11,14 +11,21 @@ export default router.post(
|
|||||||
edges: z.any(),
|
edges: z.any(),
|
||||||
nodes: z.any(),
|
nodes: z.any(),
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
imageUrl: z.number(),
|
imageUrl: z.string(),
|
||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { edges, nodes, id, imageUrl } = req.body;
|
const { edges, nodes, id, imageUrl } = req.body;
|
||||||
if (!imageUrl.includes("http")) {
|
if (!imageUrl.includes("http")) {
|
||||||
return res.status(400).send({ message: "图片地址不合法" });
|
return res.status(400).send({ message: "图片地址不合法" });
|
||||||
}
|
}
|
||||||
// if
|
nodes.forEach((node: any) => {
|
||||||
|
if (node.type == "upload") {
|
||||||
|
node.data.image = node.data.image ? new URL(node.data.image).pathname : "";
|
||||||
|
}
|
||||||
|
if (node.type == "generated") {
|
||||||
|
node.data.generatedImage = node.data.generatedImage ? new URL(node.data.generatedImage).pathname : "";
|
||||||
|
}
|
||||||
|
});
|
||||||
await u
|
await u
|
||||||
.db("o_storyboard")
|
.db("o_storyboard")
|
||||||
.where("id", id)
|
.where("id", id)
|
||||||
|
|||||||
112
src/types/database.d.ts
vendored
112
src/types/database.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// @db-hash f8ab3a7aee659c729c770f3555728f1b
|
// @db-hash 8af8e41e3ca0cb5ee554944515d72ba8
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
export interface memories {
|
export interface memories {
|
||||||
@ -35,12 +35,18 @@ export interface o_assets {
|
|||||||
'projectId'?: number | null;
|
'projectId'?: number | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
'remark'?: string | null;
|
'remark'?: string | null;
|
||||||
'scriptId'?: number | null;
|
|
||||||
'sonId'?: number | null;
|
'sonId'?: number | null;
|
||||||
'startTime'?: number | null;
|
'startTime'?: number | null;
|
||||||
'state'?: string | null;
|
'state'?: string | null;
|
||||||
'type'?: string | null;
|
'type'?: string | null;
|
||||||
}
|
}
|
||||||
|
export interface o_chatHistory {
|
||||||
|
'data'?: string | null;
|
||||||
|
'id'?: number;
|
||||||
|
'novel'?: string | null;
|
||||||
|
'projectId'?: number | null;
|
||||||
|
'type'?: string | null;
|
||||||
|
}
|
||||||
export interface o_event {
|
export interface o_event {
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
'detail'?: string | null;
|
'detail'?: string | null;
|
||||||
@ -61,10 +67,33 @@ export interface o_image {
|
|||||||
'assetsId'?: number | null;
|
'assetsId'?: number | null;
|
||||||
'filePath'?: string | null;
|
'filePath'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'model'?: string | null;
|
'projectId'?: number | null;
|
||||||
'resolution'?: string | null;
|
'scriptId'?: number | null;
|
||||||
'state'?: string | null;
|
'state'?: string | null;
|
||||||
'type'?: string | null;
|
'type'?: string | null;
|
||||||
|
'videoId'?: number | null;
|
||||||
|
}
|
||||||
|
export interface o_model {
|
||||||
|
'apiKey'?: string | null;
|
||||||
|
'baseUrl'?: string | null;
|
||||||
|
'createTime'?: number | null;
|
||||||
|
'id'?: number;
|
||||||
|
'index'?: number | null;
|
||||||
|
'manufacturer'?: string | null;
|
||||||
|
'model'?: string | null;
|
||||||
|
'modelType'?: string | null;
|
||||||
|
'type'?: string | null;
|
||||||
|
}
|
||||||
|
export interface o_myTasks {
|
||||||
|
'describe'?: string | null;
|
||||||
|
'id'?: number;
|
||||||
|
'model'?: string | null;
|
||||||
|
'projectId'?: number | null;
|
||||||
|
'reason'?: string | null;
|
||||||
|
'relatedObjects'?: string | null;
|
||||||
|
'startTime'?: number | null;
|
||||||
|
'state'?: string | null;
|
||||||
|
'taskClass'?: string | null;
|
||||||
}
|
}
|
||||||
export interface o_novel {
|
export interface o_novel {
|
||||||
'chapter'?: string | null;
|
'chapter'?: string | null;
|
||||||
@ -97,6 +126,15 @@ export interface o_project {
|
|||||||
'userId'?: number | null;
|
'userId'?: number | null;
|
||||||
'videoRatio'?: string | null;
|
'videoRatio'?: string | null;
|
||||||
}
|
}
|
||||||
|
export interface o_prompts {
|
||||||
|
'code'?: string | null;
|
||||||
|
'customValue'?: string | null;
|
||||||
|
'defaultValue'?: string | null;
|
||||||
|
'id'?: number;
|
||||||
|
'name'?: string | null;
|
||||||
|
'parentCode'?: string | null;
|
||||||
|
'type'?: string | null;
|
||||||
|
}
|
||||||
export interface o_script {
|
export interface o_script {
|
||||||
'content'?: string | null;
|
'content'?: string | null;
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
@ -104,10 +142,25 @@ export interface o_script {
|
|||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'projectId'?: number | null;
|
'projectId'?: number | null;
|
||||||
}
|
}
|
||||||
|
export interface o_scriptAssets {
|
||||||
|
'assetsId'?: number | null;
|
||||||
|
'id'?: number;
|
||||||
|
'scriptId'?: number | null;
|
||||||
|
}
|
||||||
|
export interface o_scriptOutline {
|
||||||
|
'id'?: number;
|
||||||
|
'outlineId'?: number | null;
|
||||||
|
'scriptId'?: number | null;
|
||||||
|
}
|
||||||
export interface o_setting {
|
export interface o_setting {
|
||||||
'key'?: string | null;
|
'key'?: string | null;
|
||||||
'value'?: string | null;
|
'value'?: string | null;
|
||||||
}
|
}
|
||||||
|
export interface o_skills {
|
||||||
|
'id'?: number;
|
||||||
|
'name'?: string | null;
|
||||||
|
'startTime'?: number | null;
|
||||||
|
}
|
||||||
export interface o_storyboard {
|
export interface o_storyboard {
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
'detail'?: string | null;
|
'detail'?: string | null;
|
||||||
@ -116,7 +169,6 @@ export interface o_storyboard {
|
|||||||
'id'?: number;
|
'id'?: number;
|
||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
'scriptId'?: number | null;
|
|
||||||
'seconds'?: string | null;
|
'seconds'?: string | null;
|
||||||
}
|
}
|
||||||
export interface o_storyboardFlow {
|
export interface o_storyboardFlow {
|
||||||
@ -124,6 +176,11 @@ export interface o_storyboardFlow {
|
|||||||
'id'?: number;
|
'id'?: number;
|
||||||
'stroryboardId': number;
|
'stroryboardId': number;
|
||||||
}
|
}
|
||||||
|
export interface o_storyboardScript {
|
||||||
|
'id'?: number;
|
||||||
|
'scriptId'?: number | null;
|
||||||
|
'storyboardId'?: number | null;
|
||||||
|
}
|
||||||
export interface o_tasks {
|
export interface o_tasks {
|
||||||
'describe'?: string | null;
|
'describe'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
@ -152,27 +209,36 @@ export interface o_vendorConfig {
|
|||||||
'version'?: string | null;
|
'version'?: string | null;
|
||||||
}
|
}
|
||||||
export interface o_video {
|
export interface o_video {
|
||||||
|
'configId'?: number | null;
|
||||||
'errorReason'?: string | null;
|
'errorReason'?: string | null;
|
||||||
'filePath'?: string | null;
|
'filePath'?: string | null;
|
||||||
|
'firstFrame'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'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;
|
'model'?: string | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
'resolution'?: string | null;
|
'resolution'?: string | null;
|
||||||
'storyboardId'?: number | null;
|
'scriptId'?: number | null;
|
||||||
|
'state'?: number | null;
|
||||||
|
'storyboardImgs'?: string | null;
|
||||||
|
'time'?: number | null;
|
||||||
|
}
|
||||||
|
export interface o_videoConfig {
|
||||||
|
'aiConfigId'?: number | null;
|
||||||
|
'audioEnabled'?: number | null;
|
||||||
|
'createTime'?: number | null;
|
||||||
|
'duration'?: number | null;
|
||||||
|
'endFrame'?: string | null;
|
||||||
|
'id'?: number;
|
||||||
|
'images'?: string | null;
|
||||||
|
'manufacturer'?: string | null;
|
||||||
|
'mode'?: string | null;
|
||||||
|
'projectId'?: number | null;
|
||||||
|
'prompt'?: string | null;
|
||||||
|
'resolution'?: string | null;
|
||||||
|
'scriptId'?: number | null;
|
||||||
|
'selectedResultId'?: number | null;
|
||||||
|
'startFrame'?: string | null;
|
||||||
'updateTime'?: number | null;
|
'updateTime'?: number | null;
|
||||||
'videoId'?: number | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DB {
|
export interface DB {
|
||||||
@ -180,18 +246,26 @@ export interface DB {
|
|||||||
"o_agentDeploy": o_agentDeploy;
|
"o_agentDeploy": o_agentDeploy;
|
||||||
"o_artStyle": o_artStyle;
|
"o_artStyle": o_artStyle;
|
||||||
"o_assets": o_assets;
|
"o_assets": o_assets;
|
||||||
|
"o_chatHistory": o_chatHistory;
|
||||||
"o_event": o_event;
|
"o_event": o_event;
|
||||||
"o_eventChapter": o_eventChapter;
|
"o_eventChapter": o_eventChapter;
|
||||||
"o_flowData": o_flowData;
|
"o_flowData": o_flowData;
|
||||||
"o_image": o_image;
|
"o_image": o_image;
|
||||||
|
"o_model": o_model;
|
||||||
|
"o_myTasks": o_myTasks;
|
||||||
"o_novel": o_novel;
|
"o_novel": o_novel;
|
||||||
"o_outline": o_outline;
|
"o_outline": o_outline;
|
||||||
"o_outlineNovel": o_outlineNovel;
|
"o_outlineNovel": o_outlineNovel;
|
||||||
"o_project": o_project;
|
"o_project": o_project;
|
||||||
|
"o_prompts": o_prompts;
|
||||||
"o_script": o_script;
|
"o_script": o_script;
|
||||||
|
"o_scriptAssets": o_scriptAssets;
|
||||||
|
"o_scriptOutline": o_scriptOutline;
|
||||||
"o_setting": o_setting;
|
"o_setting": o_setting;
|
||||||
|
"o_skills": o_skills;
|
||||||
"o_storyboard": o_storyboard;
|
"o_storyboard": o_storyboard;
|
||||||
"o_storyboardFlow": o_storyboardFlow;
|
"o_storyboardFlow": o_storyboardFlow;
|
||||||
|
"o_storyboardScript": o_storyboardScript;
|
||||||
"o_tasks": o_tasks;
|
"o_tasks": o_tasks;
|
||||||
"o_user": o_user;
|
"o_user": o_user;
|
||||||
"o_vendorConfig": o_vendorConfig;
|
"o_vendorConfig": o_vendorConfig;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user