Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
# Conflicts: # src/router.ts # src/types/database.d.ts
This commit is contained in:
commit
9da2610cde
@ -1,4 +1,4 @@
|
|||||||
// @routes-hash 4320384558d78e1f5a302e2126dd9699
|
// @routes-hash 6f4b1b062e88dc5cb13583c50c217537
|
||||||
import { Express } from "express";
|
import { Express } from "express";
|
||||||
|
|
||||||
import route1 from "./routes/agents/clearMemory";
|
import route1 from "./routes/agents/clearMemory";
|
||||||
@ -55,13 +55,13 @@ import route51 from "./routes/production/getFlowData";
|
|||||||
import route52 from "./routes/production/getProductionData";
|
import route52 from "./routes/production/getProductionData";
|
||||||
import route53 from "./routes/production/getStoryboardData";
|
import route53 from "./routes/production/getStoryboardData";
|
||||||
import route54 from "./routes/production/saveFlowData";
|
import route54 from "./routes/production/saveFlowData";
|
||||||
import route55 from "./routes/production/storyboard/downPreviewImage";
|
import route55 from "./routes/production/storyboard/batchGenerateImage";
|
||||||
import route56 from "./routes/production/storyboard/getStoryboardData";
|
import route56 from "./routes/production/storyboard/downPreviewImage";
|
||||||
import route57 from "./routes/production/storyboard/previewImage";
|
import route57 from "./routes/production/storyboard/getStoryboardData";
|
||||||
import route58 from "./routes/production/workbench/confirmSelection";
|
import route58 from "./routes/production/storyboard/previewImage";
|
||||||
import route59 from "./routes/production/workbench/delVideo";
|
import route59 from "./routes/production/workbench/confirmSelection";
|
||||||
import route60 from "./routes/production/workbench/generateVideo";
|
import route60 from "./routes/production/workbench/delVideo";
|
||||||
import route61 from "./routes/production/workbench/generateVideoPrompt";
|
import route61 from "./routes/production/workbench/generateVideo";
|
||||||
import route62 from "./routes/production/workbench/getChatLines";
|
import route62 from "./routes/production/workbench/getChatLines";
|
||||||
import route63 from "./routes/production/workbench/getVideoModelDetail";
|
import route63 from "./routes/production/workbench/getVideoModelDetail";
|
||||||
import route64 from "./routes/production/workbench/videoPolling";
|
import route64 from "./routes/production/workbench/videoPolling";
|
||||||
@ -171,13 +171,13 @@ export default async (app: Express) => {
|
|||||||
app.use("/api/production/getProductionData", route52);
|
app.use("/api/production/getProductionData", route52);
|
||||||
app.use("/api/production/getStoryboardData", route53);
|
app.use("/api/production/getStoryboardData", route53);
|
||||||
app.use("/api/production/saveFlowData", route54);
|
app.use("/api/production/saveFlowData", route54);
|
||||||
app.use("/api/production/storyboard/downPreviewImage", route55);
|
app.use("/api/production/storyboard/batchGenerateImage", route55);
|
||||||
app.use("/api/production/storyboard/getStoryboardData", route56);
|
app.use("/api/production/storyboard/downPreviewImage", route56);
|
||||||
app.use("/api/production/storyboard/previewImage", route57);
|
app.use("/api/production/storyboard/getStoryboardData", route57);
|
||||||
app.use("/api/production/workbench/confirmSelection", route58);
|
app.use("/api/production/storyboard/previewImage", route58);
|
||||||
app.use("/api/production/workbench/delVideo", route59);
|
app.use("/api/production/workbench/confirmSelection", route59);
|
||||||
app.use("/api/production/workbench/generateVideo", route60);
|
app.use("/api/production/workbench/delVideo", route60);
|
||||||
app.use("/api/production/workbench/generateVideoPrompt", route61);
|
app.use("/api/production/workbench/generateVideo", route61);
|
||||||
app.use("/api/production/workbench/getChatLines", route62);
|
app.use("/api/production/workbench/getChatLines", route62);
|
||||||
app.use("/api/production/workbench/getVideoModelDetail", route63);
|
app.use("/api/production/workbench/getVideoModelDetail", route63);
|
||||||
app.use("/api/production/workbench/videoPolling", route64);
|
app.use("/api/production/workbench/videoPolling", route64);
|
||||||
|
|||||||
74
src/routes/production/storyboard/batchGenerateImage.ts
Normal file
74
src/routes/production/storyboard/batchGenerateImage.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import express from "express";
|
||||||
|
import u from "@/utils";
|
||||||
|
import { z } from "zod";
|
||||||
|
import sharp from "sharp";
|
||||||
|
import { success } from "@/lib/responseFormat";
|
||||||
|
import { validateFields } from "@/middleware/middleware";
|
||||||
|
import { Output } from "ai";
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
export default router.post(
|
||||||
|
"/",
|
||||||
|
validateFields({
|
||||||
|
storyboardIds: z.array(z.number()),
|
||||||
|
projectId: z.number(),
|
||||||
|
}),
|
||||||
|
async (req, res) => {
|
||||||
|
const { storyboardIds, projectId } = req.body;
|
||||||
|
|
||||||
|
const projectSettingData = await u.db("o_project").where("id", projectId).select("imageModel", "imageQuality", "artStyle").first();
|
||||||
|
|
||||||
|
const sceneArkPrompt = u.getArtPrompt(projectSettingData?.artStyle || "", "art_storyboard");
|
||||||
|
const storyboardData = await u.db("o_storyboard").whereIn("id", storyboardIds).select("id", "description", "title");
|
||||||
|
const { text } = await u.Ai.Text("universalAi").invoke({
|
||||||
|
system: `
|
||||||
|
你需要根据用户提供的分镜的标题与描述,结合当前项目的美术风格,为我优化提示词以便生成更符合项目美术风格的分镜图片。请你只优化提示词,不要添加任何额外的描述性文字,请以JSON格式输出: [{id:"对应分镜ID",prompt:"分镜提示词"}]。
|
||||||
|
美术风格:${sceneArkPrompt}`,
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: "user",
|
||||||
|
content: `一下是我的分镜内容\n ${storyboardData.map((s) => `分镜ID:${s.id},分镜描述:${s.description},分镜标题:${s.title}`).join("\n")}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
output: Output.object({
|
||||||
|
schema: z.array(
|
||||||
|
z.object({
|
||||||
|
prompt: z.string().describe("优化后的提示词"),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
for (const item of storyboardData) {
|
||||||
|
const repeloadObj = {
|
||||||
|
prompt: text,
|
||||||
|
size: projectSettingData?.imageQuality as "1K" | "2K" | "4K",
|
||||||
|
aspectRatio: "16:9",
|
||||||
|
};
|
||||||
|
u.Ai.Image(projectSettingData?.imageModel as `${string}:${string}`).run({
|
||||||
|
prompt: text,
|
||||||
|
imageBase64: [],
|
||||||
|
size: projectSettingData?.imageQuality as "1K" | "2K" | "4K",
|
||||||
|
aspectRatio: "16:9",
|
||||||
|
taskClass: "生成图片",
|
||||||
|
describe: "资产图片生成",
|
||||||
|
relatedObjects: JSON.stringify(repeloadObj),
|
||||||
|
projectId: projectId,
|
||||||
|
});
|
||||||
|
// .then(async (imageCls) => {
|
||||||
|
// const savePath = `/${resTool.data.projectId}/assets/${resTool.data.scriptId}/${u.uuid()}.jpg`;
|
||||||
|
// await imageCls.save(savePath);
|
||||||
|
// const obj = {
|
||||||
|
// ...item,
|
||||||
|
// id: item.assetId,
|
||||||
|
// src: await u.oss.getFileUrl(savePath),
|
||||||
|
// state: "已完成",
|
||||||
|
// };
|
||||||
|
//更新对应数据库
|
||||||
|
// await u.db("o_assets").where("id", item.assetId).update({ imageId: imageId });
|
||||||
|
// await u.db("o_image").where({ id: imageId }).update({ state: "已完成", filePath: savePath });
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(200).send(success());
|
||||||
|
},
|
||||||
|
);
|
||||||
22
src/types/database.d.ts
vendored
22
src/types/database.d.ts
vendored
@ -1,18 +1,12 @@
|
|||||||
// @db-hash 06e91b1ef334867ed5ea41d5a857d07a
|
// @db-hash f7bc2fdb80756d5536929eb47155578b
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
export interface _o_project_old_20260328 {
|
export interface _o_script_old_20260327 {
|
||||||
'artStyle'?: string | null;
|
'content'?: string | null;
|
||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
'id'?: number | null;
|
'id'?: number;
|
||||||
'imageModel'?: string | null;
|
|
||||||
'intro'?: string | null;
|
|
||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'projectType'?: string | null;
|
'projectId'?: number | null;
|
||||||
'type'?: string | null;
|
|
||||||
'userId'?: number | null;
|
|
||||||
'videoModel'?: string | null;
|
|
||||||
'videoRatio'?: string | null;
|
|
||||||
}
|
}
|
||||||
export interface memories {
|
export interface memories {
|
||||||
'content': string;
|
'content': string;
|
||||||
@ -60,7 +54,6 @@ export interface o_assets {
|
|||||||
'name'?: string | null;
|
'name'?: string | null;
|
||||||
'projectId'?: number | null;
|
'projectId'?: number | null;
|
||||||
'prompt'?: string | null;
|
'prompt'?: string | null;
|
||||||
'promptState'?: string | null;
|
|
||||||
'remark'?: string | null;
|
'remark'?: string | null;
|
||||||
'scriptId'?: number | null;
|
'scriptId'?: number | null;
|
||||||
'startTime'?: number | null;
|
'startTime'?: number | null;
|
||||||
@ -180,7 +173,7 @@ export interface o_storyboard {
|
|||||||
'filePath'?: string | null;
|
'filePath'?: string | null;
|
||||||
'frameMode'?: string | null;
|
'frameMode'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'index'?: number | null;
|
'index'?: string | null;
|
||||||
'lines'?: string | null;
|
'lines'?: string | null;
|
||||||
'mode'?: string | null;
|
'mode'?: string | null;
|
||||||
'model'?: string | null;
|
'model'?: string | null;
|
||||||
@ -191,7 +184,6 @@ export interface o_storyboard {
|
|||||||
'sound'?: string | null;
|
'sound'?: string | null;
|
||||||
'state'?: string | null;
|
'state'?: string | null;
|
||||||
'title'?: string | null;
|
'title'?: string | null;
|
||||||
'videoPrompt'?: string | null;
|
|
||||||
}
|
}
|
||||||
export interface o_tasks {
|
export interface o_tasks {
|
||||||
'describe'?: string | null;
|
'describe'?: string | null;
|
||||||
@ -246,7 +238,7 @@ export interface o_videoConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DB {
|
export interface DB {
|
||||||
"_o_project_old_20260328": _o_project_old_20260328;
|
"_o_script_old_20260327": _o_script_old_20260327;
|
||||||
"memories": memories;
|
"memories": memories;
|
||||||
"o_agentDeploy": o_agentDeploy;
|
"o_agentDeploy": o_agentDeploy;
|
||||||
"o_agentWorkData": o_agentWorkData;
|
"o_agentWorkData": o_agentWorkData;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user