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
c148fc31f2
@ -309,11 +309,16 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
|
|||||||
table.integer("id").notNullable();
|
table.integer("id").notNullable();
|
||||||
table.integer("scriptId");
|
table.integer("scriptId");
|
||||||
table.text("name");
|
table.text("name");
|
||||||
table.text("detail");
|
|
||||||
table.text("prompt");
|
table.text("prompt");
|
||||||
table.text("seconds");
|
|
||||||
table.text("filePath");
|
table.text("filePath");
|
||||||
|
table.text("model");
|
||||||
|
table.text("mode");
|
||||||
|
table.text("duration");
|
||||||
|
table.text("resolution");
|
||||||
table.text("frameType");
|
table.text("frameType");
|
||||||
|
table.text("camera");
|
||||||
|
table.text("sound");
|
||||||
|
table.text("associateAssetsIds");
|
||||||
table.integer("createTime");
|
table.integer("createTime");
|
||||||
table.primary(["id"]);
|
table.primary(["id"]);
|
||||||
table.unique(["id"]);
|
table.unique(["id"]);
|
||||||
|
|||||||
@ -12,7 +12,6 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id } = req.body;
|
const { id } = req.body;
|
||||||
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) {
|
||||||
const parseFlow = JSON.parse(storyboardFlowData.flowData);
|
const parseFlow = JSON.parse(storyboardFlowData.flowData);
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export default router.post(
|
|||||||
});
|
});
|
||||||
const [id] = await u.db("o_storyboard").insert({
|
const [id] = await u.db("o_storyboard").insert({
|
||||||
filePath: new URL(imageUrl).pathname,
|
filePath: new URL(imageUrl).pathname,
|
||||||
|
createTime: Date.now(),
|
||||||
});
|
});
|
||||||
await u.db("o_storyboardFlow").insert({
|
await u.db("o_storyboardFlow").insert({
|
||||||
stroryboardId: id,
|
stroryboardId: id,
|
||||||
|
|||||||
@ -13,20 +13,7 @@ export default router.post(
|
|||||||
const { scriptId } = req.body;
|
const { scriptId } = req.body;
|
||||||
|
|
||||||
// 1. 查出该剧本下所有分镜
|
// 1. 查出该剧本下所有分镜
|
||||||
const storyboards = await u
|
const storyboards = await u.db("o_storyboard").where("o_storyboard.scriptId", scriptId).select("*").orderBy("o_storyboard.createTime", "asc");
|
||||||
.db("o_storyboard")
|
|
||||||
.where("o_storyboard.scriptId", scriptId)
|
|
||||||
.select(
|
|
||||||
"o_storyboard.id",
|
|
||||||
"o_storyboard.name",
|
|
||||||
"o_storyboard.detail",
|
|
||||||
"o_storyboard.prompt",
|
|
||||||
"o_storyboard.seconds",
|
|
||||||
"o_storyboard.filePath",
|
|
||||||
"o_storyboard.frameType",
|
|
||||||
"o_storyboard.scriptId",
|
|
||||||
)
|
|
||||||
.orderBy("o_storyboard.createTime", "asc");
|
|
||||||
|
|
||||||
if (storyboards.length === 0) {
|
if (storyboards.length === 0) {
|
||||||
return res.status(200).send(success([]));
|
return res.status(200).send(success([]));
|
||||||
@ -71,11 +58,39 @@ export default router.post(
|
|||||||
const data = await Promise.all(
|
const data = await Promise.all(
|
||||||
storyboards.map(async (storyboard) => {
|
storyboards.map(async (storyboard) => {
|
||||||
const sid = storyboard.id as number;
|
const sid = storyboard.id as number;
|
||||||
|
const config = configMap.get(sid) ?? null;
|
||||||
|
let configDataWithFilePath: any[] = [];
|
||||||
|
if (config?.data) {
|
||||||
|
const parsedData: { id: number; type: string }[] = JSON.parse(config.data);
|
||||||
|
configDataWithFilePath = await Promise.all(
|
||||||
|
parsedData.map(async (item) => {
|
||||||
|
if (item.type === "storyboard") {
|
||||||
|
const row = await u.db("o_storyboard").where("id", item.id).select("filePath").first();
|
||||||
|
return row?.filePath ? await u.oss.getFileUrl(row.filePath) : null;
|
||||||
|
}
|
||||||
|
if (item.type === "assets") {
|
||||||
|
const row = await u
|
||||||
|
.db("o_assets")
|
||||||
|
.where("o_assets.id", item.id)
|
||||||
|
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
|
||||||
|
.select("o_image.filePath")
|
||||||
|
.first();
|
||||||
|
return row?.filePath ? await u.oss.getFileUrl(row.filePath) : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...storyboard,
|
...storyboard,
|
||||||
filePath: storyboard.filePath && (await u.oss.getFileUrl(storyboard.filePath!)),
|
filePath: storyboard.filePath && (await u.oss.getFileUrl(storyboard.filePath!)),
|
||||||
config: configMap.get(sid) ?? null,
|
config: config ? { ...config, data: configDataWithFilePath } : null,
|
||||||
videos: videoMap.get(sid) ?? [],
|
videos: await Promise.all(
|
||||||
|
(videoMap.get(sid) ?? []).map(async (video) => ({
|
||||||
|
...video,
|
||||||
|
filePath: video.filePath ? await u.oss.getFileUrl(video.filePath) : null,
|
||||||
|
})),
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -17,7 +17,8 @@ export default router.post(
|
|||||||
storyboardData.map(async (i) => {
|
storyboardData.map(async (i) => {
|
||||||
return {
|
return {
|
||||||
...i,
|
...i,
|
||||||
image: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "",
|
title: i.name,
|
||||||
|
src: i.filePath ? await u.oss.getFileUrl(i.filePath!) : "",
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default router.post(
|
|||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
model: z.string(),
|
model: z.string(),
|
||||||
duration: z.string(),
|
duration: z.number(),
|
||||||
resolution: z.string(),
|
resolution: z.string(),
|
||||||
audio: z.boolean().optional(),
|
audio: z.boolean().optional(),
|
||||||
mode: z.string(),
|
mode: z.string(),
|
||||||
|
|||||||
108
src/types/database.d.ts
vendored
108
src/types/database.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// @db-hash bd46e7c381481a74efedc662a4f9049f
|
// @db-hash bea1bd617996a9e12ad951edcce03880
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
export interface memories {
|
export interface memories {
|
||||||
@ -35,18 +35,12 @@ 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;
|
||||||
@ -67,33 +61,10 @@ export interface o_image {
|
|||||||
'assetsId'?: number | null;
|
'assetsId'?: number | null;
|
||||||
'filePath'?: string | null;
|
'filePath'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'projectId'?: number | null;
|
'model'?: string | null;
|
||||||
'scriptId'?: number | null;
|
'resolution'?: string | 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;
|
||||||
@ -126,15 +97,6 @@ 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;
|
||||||
@ -142,40 +104,31 @@ 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 {
|
||||||
|
'associateAssetsIds'?: string | null;
|
||||||
|
'camera'?: string | null;
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
|
'duration'?: string | null;
|
||||||
|
'filePath'?: string | null;
|
||||||
|
'frameType'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
|
'mode'?: string | null;
|
||||||
|
'model'?: string | null;
|
||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
|
'prompt'?: string | null;
|
||||||
|
'resolution'?: string | null;
|
||||||
|
'scriptId'?: number | null;
|
||||||
|
'sound'?: string | null;
|
||||||
}
|
}
|
||||||
export interface o_storyboardFlow {
|
export interface o_storyboardFlow {
|
||||||
'flowData': string;
|
'flowData': string;
|
||||||
'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;
|
||||||
@ -204,36 +157,27 @@ 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;
|
||||||
'model'?: string | null;
|
|
||||||
'prompt'?: string | null;
|
|
||||||
'resolution'?: string | null;
|
|
||||||
'scriptId'?: number | null;
|
'scriptId'?: number | null;
|
||||||
'state'?: number | null;
|
'state'?: string | null;
|
||||||
'storyboardImgs'?: string | null;
|
'storyboardId'?: number | null;
|
||||||
'time'?: number | null;
|
'time'?: number | null;
|
||||||
}
|
}
|
||||||
export interface o_videoConfig {
|
export interface o_videoConfig {
|
||||||
'aiConfigId'?: number | null;
|
'audio'?: number | null;
|
||||||
'audioEnabled'?: number | null;
|
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
|
'data'?: string | null;
|
||||||
'duration'?: number | null;
|
'duration'?: number | null;
|
||||||
'endFrame'?: string | null;
|
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'images'?: string | null;
|
|
||||||
'manufacturer'?: string | null;
|
|
||||||
'mode'?: string | null;
|
'mode'?: string | null;
|
||||||
'projectId'?: number | null;
|
'model'?: string | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
'resolution'?: string | null;
|
'resolution'?: string | null;
|
||||||
'scriptId'?: number | null;
|
'storyboardId'?: number | null;
|
||||||
'selectedResultId'?: number | null;
|
|
||||||
'startFrame'?: string | null;
|
|
||||||
'updateTime'?: number | null;
|
'updateTime'?: number | null;
|
||||||
|
'videoId'?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DB {
|
export interface DB {
|
||||||
@ -241,26 +185,18 @@ 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