Merge branch 'develop' of https://github.com/HBAI-Ltd/Toonflow-app into develop
This commit is contained in:
commit
11b69cc216
@ -50,29 +50,6 @@ export default router.post(
|
||||
}
|
||||
}),
|
||||
);
|
||||
const assetsIds = images.map((i) => {
|
||||
if (i._type == "storyboard") {
|
||||
return i.associateAssetsIds;
|
||||
}
|
||||
});
|
||||
const setIds = new Set(assetsIds.filter(Boolean).flat());
|
||||
|
||||
const assetsData = await u
|
||||
.db("o_assets")
|
||||
.leftJoin("o_image", "o_assets.imageId", "o_image.id")
|
||||
.where("o_assets.id", "in", Array.from(setIds))
|
||||
.select("o_assets.id", "o_image.filePath", "o_assets.name", "o_assets.type");
|
||||
await Promise.all(
|
||||
assetsData.map(async (i) => {
|
||||
if (i.filePath) {
|
||||
i.filePath = await u.oss.getFileUrl(i.filePath);
|
||||
}
|
||||
}),
|
||||
);
|
||||
const assetsRecord: Record<number, any> = {};
|
||||
assetsData.forEach((i) => {
|
||||
assetsRecord[i.id] = i;
|
||||
});
|
||||
|
||||
// 拆分 assets 和 storyboard
|
||||
const assets: any[] = [];
|
||||
@ -85,7 +62,7 @@ export default router.post(
|
||||
type: item.type,
|
||||
name: item.name,
|
||||
});
|
||||
if (item._type === "storyboard") {
|
||||
if (item._type === "storyboard")
|
||||
storyboard.push({
|
||||
videoDesc: item.videoDesc,
|
||||
prompt: item.prompt,
|
||||
@ -94,30 +71,10 @@ export default router.post(
|
||||
associateAssetsIds: item.associateAssetsIds,
|
||||
shouldGenerateImage: item.shouldGenerateImage,
|
||||
});
|
||||
if (item.associateAssetsIds && item.associateAssetsIds.length) {
|
||||
item.associateAssetsIds.forEach((i: number) => {
|
||||
const data = assetsRecord[i];
|
||||
const extingIndex = assets.find((sub) => sub.id == data.id);
|
||||
if (data && !extingIndex) {
|
||||
assets.push({
|
||||
id: data.id,
|
||||
type: data.type,
|
||||
name: data.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const [id, modelData] = model.split(":");
|
||||
const projectData = await u.db("o_project").select("*").where({ id: projectId }).first();
|
||||
const videoPrompt = await u.db("o_prompt").where("type", "videoPromptGeneration").first();
|
||||
let videoPromptGeneration = "" as string | undefined;
|
||||
if (videoPrompt && videoPrompt.useData) {
|
||||
videoPromptGeneration = videoPrompt.useData;
|
||||
} else {
|
||||
videoPromptGeneration = videoPrompt?.data ?? undefined;
|
||||
}
|
||||
const artStyle = projectData?.artStyle || "无";
|
||||
const visualManual = u.getArtPrompt(artStyle, "art_skills", "art_storyboard_video");
|
||||
const content = `
|
||||
@ -137,7 +94,7 @@ export default router.post(
|
||||
|
||||
try {
|
||||
const { text } = await u.Ai.Text("universalAi").invoke({
|
||||
system: videoPromptGeneration,
|
||||
system: videoPrompt?.data!,
|
||||
messages: [
|
||||
{
|
||||
role: "assistant",
|
||||
|
||||
@ -50,7 +50,7 @@ export default router.post(
|
||||
i.filePath = i.filePath ? await u.oss.getFileUrl(i.filePath) : "";
|
||||
}),
|
||||
);
|
||||
const storyboardTrackRecord:Record<number,any[]> = {};
|
||||
const storyboardTrackRecord: Record<number, any[]> = {};
|
||||
storyboardList.forEach((i) => {
|
||||
if (storyboardTrackRecord[i.trackId!]) {
|
||||
storyboardTrackRecord[i.trackId!].push({
|
||||
@ -61,13 +61,15 @@ export default router.post(
|
||||
...(i.id != null ? { id: i.id } : {}),
|
||||
});
|
||||
} else {
|
||||
storyboardTrackRecord[i.trackId!] = [{
|
||||
src: i.filePath,
|
||||
fileType: "image",
|
||||
sources: "storyboard",
|
||||
...(i.prompt != null ? { prompt: i.videoDesc } : {}),
|
||||
...(i.id != null ? { id: i.id } : {}),
|
||||
}];
|
||||
storyboardTrackRecord[i.trackId!] = [
|
||||
{
|
||||
src: i.filePath,
|
||||
fileType: "image",
|
||||
sources: "storyboard",
|
||||
...(i.prompt != null ? { prompt: i.videoDesc } : {}),
|
||||
...(i.id != null ? { id: i.id } : {}),
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
// 按 storyboardId 分组的资产数据,key 为 storyboardId
|
||||
@ -88,7 +90,7 @@ export default router.post(
|
||||
name: i.name,
|
||||
describe: i.describe,
|
||||
type: i.type,
|
||||
fileType: "image" as const,
|
||||
fileType: "image" as const,
|
||||
sources: "assets",
|
||||
src: i.filePath ? await u.oss.getFileUrl(i.filePath) : "",
|
||||
};
|
||||
@ -143,7 +145,7 @@ export default router.post(
|
||||
storyboardList: await Promise.all(
|
||||
storyboardList.map(async (s) => ({
|
||||
...s,
|
||||
src: s.filePath ? await u.oss.getFileUrl(s.filePath) : "",
|
||||
src: s.filePath,
|
||||
})),
|
||||
),
|
||||
trackList,
|
||||
|
||||
36
src/types/database.d.ts
vendored
36
src/types/database.d.ts
vendored
@ -1,6 +1,37 @@
|
||||
// @db-hash 3296433eb24314b094ac5d3839c049c5
|
||||
// @db-hash 6cd709d9bdfe00c4dc87961a8ebba149
|
||||
//该文件由脚本自动生成,请勿手动修改
|
||||
|
||||
export interface _o_project_old_20260404 {
|
||||
'artStyle'?: string | null;
|
||||
'createTime'?: number | null;
|
||||
'directorManual'?: string | null;
|
||||
'id'?: number | null;
|
||||
'imageModel'?: string | null;
|
||||
'imageQuality'?: string | null;
|
||||
'intro'?: string | null;
|
||||
'mode'?: string | null;
|
||||
'name'?: string | null;
|
||||
'projectType'?: string | null;
|
||||
'type'?: string | null;
|
||||
'userId'?: number | null;
|
||||
'videoModel'?: string | null;
|
||||
'videoRatio'?: string | null;
|
||||
}
|
||||
export interface _o_prompt_old_20260406 {
|
||||
'data'?: string | null;
|
||||
'id'?: number;
|
||||
'name'?: string | null;
|
||||
'type'?: string | null;
|
||||
'useData'?: string | null;
|
||||
}
|
||||
export interface _o_prompt_old_20260406_1 {
|
||||
'data'?: string | null;
|
||||
'id'?: number;
|
||||
'name'?: string | null;
|
||||
'TEXT'?: any | null;
|
||||
'type'?: string | null;
|
||||
'useData'?: string | null;
|
||||
}
|
||||
export interface memories {
|
||||
'content': string;
|
||||
'createTime': number;
|
||||
@ -232,6 +263,9 @@ export interface o_videoTrack {
|
||||
}
|
||||
|
||||
export interface DB {
|
||||
"_o_project_old_20260404": _o_project_old_20260404;
|
||||
"_o_prompt_old_20260406": _o_prompt_old_20260406;
|
||||
"_o_prompt_old_20260406_1": _o_prompt_old_20260406_1;
|
||||
"memories": memories;
|
||||
"o_agentDeploy": o_agentDeploy;
|
||||
"o_agentWorkData": o_agentWorkData;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user