Merge branch 'develop' of https://github.com/HBAI-Ltd/Toonflow-app into develop
This commit is contained in:
commit
a78a9a1b6a
@ -14,6 +14,7 @@ export default router.post(
|
|||||||
const { id } = req.body;
|
const { id } = req.body;
|
||||||
const assetsData = await u.db("o_image").where("assetsId", id);
|
const assetsData = await u.db("o_image").where("assetsId", id);
|
||||||
await Promise.all(assetsData.map((i) => i.filePath && u.oss.deleteFile(i.filePath)));
|
await Promise.all(assetsData.map((i) => i.filePath && u.oss.deleteFile(i.filePath)));
|
||||||
|
await u.db("o_image").where({ assetsId: id }).delete();
|
||||||
await u.db("o_assets").where({ id }).delete();
|
await u.db("o_assets").where({ id }).delete();
|
||||||
res.status(200).send(success({ message: "删除资产成功" }));
|
res.status(200).send(success({ message: "删除资产成功" }));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,9 @@ export default router.post(
|
|||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id } = req.body;
|
const { id } = req.body;
|
||||||
await u.db("o_video").where("id", id).delete();
|
await u.db("o_video").where("id", id).delete();
|
||||||
|
await u.db("o_videoTrack").where("videoId", id).update({
|
||||||
|
videoId: null,
|
||||||
|
});
|
||||||
res.status(200).send(success({ message: "视频删除成功" }));
|
res.status(200).send(success({ message: "视频删除成功" }));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -76,9 +76,7 @@ export default router.post(
|
|||||||
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();
|
||||||
const artStyle = projectData?.artStyle || "无";
|
const artStyle = projectData?.artStyle || "无";
|
||||||
const data = projectData?.directorManual || "无";
|
|
||||||
const visualManual = u.getArtPrompt(artStyle, "art_skills", "art_storyboard_video");
|
const visualManual = u.getArtPrompt(artStyle, "art_skills", "art_storyboard_video");
|
||||||
const directorManual = u.getArtPrompt(data, "story_skills", "narrative_sweet_romance");
|
|
||||||
const content = `
|
const content = `
|
||||||
**模型名称**:${modelData},
|
**模型名称**:${modelData},
|
||||||
**资产信息**(角色、场景、道具):${assets.map((i) => `[id:${i.id},type:${i.type},name:${i.name}]`).join(",")},
|
**资产信息**(角色、场景、道具):${assets.map((i) => `[id:${i.id},type:${i.type},name:${i.name}]`).join(",")},
|
||||||
@ -99,7 +97,7 @@ export default router.post(
|
|||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
content: `${visualManual}\n${directorManual}`,
|
content: `${visualManual}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: "user",
|
role: "user",
|
||||||
|
|||||||
@ -50,10 +50,10 @@ export default router.post(
|
|||||||
{ value: "art_prop_derivative", subDir: "art_prompt" },
|
{ value: "art_prop_derivative", subDir: "art_prompt" },
|
||||||
{ value: "art_scene", subDir: "art_prompt" },
|
{ value: "art_scene", subDir: "art_prompt" },
|
||||||
{ value: "art_scene_derivative", subDir: "art_prompt" },
|
{ value: "art_scene_derivative", subDir: "art_prompt" },
|
||||||
{ value: "art_storyboard", subDir: "art_prompt" },
|
{ value: "director_storyboard", subDir: "driector_skills" },
|
||||||
{ value: "art_storyboard_video", subDir: "art_prompt" },
|
{ value: "art_storyboard_video", subDir: "art_prompt" },
|
||||||
{ value: "director_planning", subDir: "driector_skills" },
|
{ value: "director_planning_style", subDir: "driector_skills" },
|
||||||
{ value: "director_storyboard_table", subDir: "driector_skills" },
|
{ value: "director_storyboard_table_style", subDir: "driector_skills" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 根据 DATA_MAP 构建 value -> subDir 的映射
|
// 根据 DATA_MAP 构建 value -> subDir 的映射
|
||||||
|
|||||||
@ -13,27 +13,35 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id } = req.body;
|
const { id } = req.body;
|
||||||
|
//删除项目
|
||||||
const scriptData = await u.db("o_script").where("projectId", id).select("id");
|
await u.db("o_project").where("id", id).delete();
|
||||||
const scriptIds = scriptData.map((item: any) => item.id);
|
//删除项目下的原文
|
||||||
|
await u.db("o_novel").where("projectId", id).delete();
|
||||||
|
// 删除项目下的剧本信息
|
||||||
|
await u.db("o_script").where("projectId", id).delete();
|
||||||
|
await u.db("o_outline").where("projectId", id).delete();
|
||||||
|
// 删除项目下的任务
|
||||||
|
await u.db("o_tasks").where("projectId", id).delete();
|
||||||
|
// 删除项目下的分镜
|
||||||
|
await u.db("o_storyboard").where("projectId", id).delete();
|
||||||
|
// 删除项目下的资产
|
||||||
|
await u.db("o_assets").where("projectId", id).delete();
|
||||||
|
//删除需要删除资产的归属图片
|
||||||
const assetsData = await u.db("o_assets").where("projectId", id).select("id");
|
const assetsData = await u.db("o_assets").where("projectId", id).select("id");
|
||||||
const assetsIds = assetsData.map((item: any) => item.id);
|
const assetsIds = assetsData.map((item: any) => item.id);
|
||||||
|
|
||||||
await u.db("o_project").where("id", id).delete();
|
|
||||||
await u.db("o_novel").where("projectId", id).delete();
|
|
||||||
await u.db("o_outline").where("projectId", id).delete();
|
|
||||||
await u.db("o_tasks").where("projectId", id).delete();
|
|
||||||
|
|
||||||
await u.db("o_script").where("projectId", id).delete();
|
|
||||||
await u.db("o_assets").where("projectId", id).delete();
|
|
||||||
|
|
||||||
if (assetsIds.length > 0) {
|
if (assetsIds.length > 0) {
|
||||||
await u.db("o_image").where("projectId", id).orWhereIn("assetsId", assetsIds).delete();
|
await u.db("o_image").orWhereIn("assetsId", assetsIds).delete();
|
||||||
}
|
}
|
||||||
|
//删除项目下的视频
|
||||||
await u.db("o_video").whereIn("scriptId", scriptIds).delete();
|
const videoData = await u.db("o_video").where("projectId", id).select("id");
|
||||||
|
const videoIds = videoData.map((item: any) => item.id);
|
||||||
|
if (videoIds.length > 0) {
|
||||||
|
await u.db("o_videoTrack").whereIn("videoId", videoIds).update({
|
||||||
|
videoId: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await u.db("o_video").where("projectId", id).delete();
|
||||||
|
//删除项目下的资源
|
||||||
try {
|
try {
|
||||||
await u.oss.deleteDirectory(`${id}/`);
|
await u.oss.deleteDirectory(`${id}/`);
|
||||||
console.log(`项目 ${id} 的OSS文件夹删除成功`);
|
console.log(`项目 ${id} 的OSS文件夹删除成功`);
|
||||||
|
|||||||
@ -51,10 +51,10 @@ export default router.post(
|
|||||||
{ value: "art_prop_derivative", subDir: "art_prompt" },
|
{ value: "art_prop_derivative", subDir: "art_prompt" },
|
||||||
{ value: "art_scene", subDir: "art_prompt" },
|
{ value: "art_scene", subDir: "art_prompt" },
|
||||||
{ value: "art_scene_derivative", subDir: "art_prompt" },
|
{ value: "art_scene_derivative", subDir: "art_prompt" },
|
||||||
{ value: "art_storyboard", subDir: "art_prompt" },
|
{ value: "director_storyboard", subDir: "driector_skills" },
|
||||||
{ value: "art_storyboard_video", subDir: "art_prompt" },
|
{ value: "art_storyboard_video", subDir: "art_prompt" },
|
||||||
{ value: "director_planning", subDir: "driector_skills" },
|
{ value: "director_planning_style", subDir: "driector_skills" },
|
||||||
{ value: "director_storyboard_table", subDir: "driector_skills" },
|
{ value: "director_storyboard_table_style", subDir: "driector_skills" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 根据 DATA_MAP 构建 value -> subDir 的映射
|
// 根据 DATA_MAP 构建 value -> subDir 的映射
|
||||||
|
|||||||
@ -15,10 +15,10 @@ const DATA_MAP: { label: string; value: string; subDir?: string }[] = [
|
|||||||
{ label: "道具衍生", value: "art_prop_derivative", subDir: "art_prompt" },
|
{ label: "道具衍生", value: "art_prop_derivative", subDir: "art_prompt" },
|
||||||
{ label: "场景", value: "art_scene", subDir: "art_prompt" },
|
{ label: "场景", value: "art_scene", subDir: "art_prompt" },
|
||||||
{ label: "场景衍生", value: "art_scene_derivative", subDir: "art_prompt" },
|
{ label: "场景衍生", value: "art_scene_derivative", subDir: "art_prompt" },
|
||||||
{ label: "分镜", value: "art_storyboard", subDir: "art_prompt" },
|
{ label: "分镜", value: "director_storyboard", subDir: "driector_skills" },
|
||||||
{ label: "分镜视频", value: "art_storyboard_video", subDir: "art_prompt" },
|
{ label: "分镜视频", value: "art_storyboard_video", subDir: "art_prompt" },
|
||||||
{ label: "技法-导演规划", value: "director_planning", subDir: "driector_skills" },
|
{ label: "技法-导演规划", value: "director_planning_style", subDir: "driector_skills" },
|
||||||
{ label: "技法-分镜表设计", value: "director_storyboard_table", subDir: "driector_skills" },
|
{ label: "技法-分镜表设计", value: "director_storyboard_table_style", subDir: "driector_skills" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 读取 md 文件内容,文件不存在时返回空字符串
|
// 读取 md 文件内容,文件不存在时返回空字符串
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export default router.post(
|
|||||||
"/",
|
"/",
|
||||||
validateFields({
|
validateFields({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
enable: z.number(),
|
||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id, enable } = req.body;
|
const { id, enable } = req.body;
|
||||||
|
|||||||
@ -95,7 +95,6 @@ export default router.post(
|
|||||||
inputValues: JSON.stringify(vendor.inputValues ?? {}),
|
inputValues: JSON.stringify(vendor.inputValues ?? {}),
|
||||||
models: JSON.stringify(vendor.models ?? []),
|
models: JSON.stringify(vendor.models ?? []),
|
||||||
code: tsCode,
|
code: tsCode,
|
||||||
enable: 0,
|
|
||||||
createTime: Date.now(),
|
createTime: Date.now(),
|
||||||
});
|
});
|
||||||
res.status(200).send(success(result.data));
|
res.status(200).send(success(result.data));
|
||||||
|
|||||||
@ -67,7 +67,6 @@ export default router.post(
|
|||||||
inputs: JSON.stringify(inputs),
|
inputs: JSON.stringify(inputs),
|
||||||
inputValues: JSON.stringify(inputValues),
|
inputValues: JSON.stringify(inputValues),
|
||||||
models: JSON.stringify(models),
|
models: JSON.stringify(models),
|
||||||
enable: id == "toonflow" ? 1 : 0,
|
|
||||||
});
|
});
|
||||||
res.status(200).send(success("更新成功"));
|
res.status(200).send(success("更新成功"));
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user