Merge branch 'develop' of https://github.com/HBAI-Ltd/Toonflow-app into develop

This commit is contained in:
ACT丶流星雨 2026-04-07 04:40:19 +08:00
commit 11b69cc216
3 changed files with 49 additions and 56 deletions

View File

@ -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 // 拆分 assets 和 storyboard
const assets: any[] = []; const assets: any[] = [];
@ -85,7 +62,7 @@ export default router.post(
type: item.type, type: item.type,
name: item.name, name: item.name,
}); });
if (item._type === "storyboard") { if (item._type === "storyboard")
storyboard.push({ storyboard.push({
videoDesc: item.videoDesc, videoDesc: item.videoDesc,
prompt: item.prompt, prompt: item.prompt,
@ -94,30 +71,10 @@ export default router.post(
associateAssetsIds: item.associateAssetsIds, associateAssetsIds: item.associateAssetsIds,
shouldGenerateImage: item.shouldGenerateImage, 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 [id, modelData] = model.split(":");
const projectData = await u.db("o_project").select("*").where({ id: projectId }).first(); const projectData = await u.db("o_project").select("*").where({ id: projectId }).first();
const videoPrompt = await u.db("o_prompt").where("type", "videoPromptGeneration").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 artStyle = projectData?.artStyle || "无";
const visualManual = u.getArtPrompt(artStyle, "art_skills", "art_storyboard_video"); const visualManual = u.getArtPrompt(artStyle, "art_skills", "art_storyboard_video");
const content = ` const content = `
@ -137,7 +94,7 @@ export default router.post(
try { try {
const { text } = await u.Ai.Text("universalAi").invoke({ const { text } = await u.Ai.Text("universalAi").invoke({
system: videoPromptGeneration, system: videoPrompt?.data!,
messages: [ messages: [
{ {
role: "assistant", role: "assistant",

View File

@ -50,7 +50,7 @@ export default router.post(
i.filePath = i.filePath ? await u.oss.getFileUrl(i.filePath) : ""; i.filePath = i.filePath ? await u.oss.getFileUrl(i.filePath) : "";
}), }),
); );
const storyboardTrackRecord:Record<number,any[]> = {}; const storyboardTrackRecord: Record<number, any[]> = {};
storyboardList.forEach((i) => { storyboardList.forEach((i) => {
if (storyboardTrackRecord[i.trackId!]) { if (storyboardTrackRecord[i.trackId!]) {
storyboardTrackRecord[i.trackId!].push({ storyboardTrackRecord[i.trackId!].push({
@ -61,13 +61,15 @@ export default router.post(
...(i.id != null ? { id: i.id } : {}), ...(i.id != null ? { id: i.id } : {}),
}); });
} else { } else {
storyboardTrackRecord[i.trackId!] = [{ storyboardTrackRecord[i.trackId!] = [
src: i.filePath, {
fileType: "image", src: i.filePath,
sources: "storyboard", fileType: "image",
...(i.prompt != null ? { prompt: i.videoDesc } : {}), sources: "storyboard",
...(i.id != null ? { id: i.id } : {}), ...(i.prompt != null ? { prompt: i.videoDesc } : {}),
}]; ...(i.id != null ? { id: i.id } : {}),
},
];
} }
}); });
// 按 storyboardId 分组的资产数据key 为 storyboardId // 按 storyboardId 分组的资产数据key 为 storyboardId
@ -88,7 +90,7 @@ export default router.post(
name: i.name, name: i.name,
describe: i.describe, describe: i.describe,
type: i.type, type: i.type,
fileType: "image" as const, fileType: "image" as const,
sources: "assets", sources: "assets",
src: i.filePath ? await u.oss.getFileUrl(i.filePath) : "", src: i.filePath ? await u.oss.getFileUrl(i.filePath) : "",
}; };
@ -143,7 +145,7 @@ export default router.post(
storyboardList: await Promise.all( storyboardList: await Promise.all(
storyboardList.map(async (s) => ({ storyboardList.map(async (s) => ({
...s, ...s,
src: s.filePath ? await u.oss.getFileUrl(s.filePath) : "", src: s.filePath,
})), })),
), ),
trackList, trackList,

View File

@ -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 { export interface memories {
'content': string; 'content': string;
'createTime': number; 'createTime': number;
@ -232,6 +263,9 @@ export interface o_videoTrack {
} }
export interface DB { 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; "memories": memories;
"o_agentDeploy": o_agentDeploy; "o_agentDeploy": o_agentDeploy;
"o_agentWorkData": o_agentWorkData; "o_agentWorkData": o_agentWorkData;