diff --git a/src/routes/storyboard/generateStoryboardApi.ts b/src/routes/storyboard/generateStoryboardApi.ts index 1ce5e2c..2c946de 100644 --- a/src/routes/storyboard/generateStoryboardApi.ts +++ b/src/routes/storyboard/generateStoryboardApi.ts @@ -16,8 +16,10 @@ export default router.post( }), async (req, res) => { const { filePath, prompt, projectId, assetsId } = req.body; + //拿到图片尺寸 + const projectInfo = await u.db("t_project").where({ id: projectId }).first(); - let data = await u.editImage(filePath, prompt, projectId); + let data = await u.editImage(filePath, prompt, projectId,projectInfo?.videoRatio!); const returnData: { id: number | null; url: string | null; diff --git a/src/utils/editImage.ts b/src/utils/editImage.ts index 1139621..175bc0e 100644 --- a/src/utils/editImage.ts +++ b/src/utils/editImage.ts @@ -77,7 +77,7 @@ async function convertDirectiveAndImages(images: Record, directi * "将@图10中圈起来的部分换成@图8" * ); */ -export default async (images: Record, directive: string, projectId: number) => { +export default async (images: Record, directive: string, projectId: number, aspectRatio: string | null) => { const { prompt, images: base64Images } = await convertDirectiveAndImages(images, directive); const apiConfig = await u.getPromptAi("editImage"); @@ -86,7 +86,7 @@ export default async (images: Record, directive: string, project systemPrompt: "根据用户提供的具体修改指令,对上传的图片进行智能编辑。", prompt: prompt, imageBase64: base64Images, - aspectRatio: "16:9", + aspectRatio: aspectRatio ? aspectRatio : "16:9", size: "1K", }, apiConfig,