【增加】midjourney 增加 --ar 参数设置

This commit is contained in:
cherishsince 2024-05-31 14:05:16 +08:00
parent 74620ebc34
commit 27f052de0a
2 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,12 @@ public class AiImageMidjourneyImagineReqVO {
@Schema(description = "模型(midjourney、niji)")
private String model;
@Schema(description = "图片宽度")
private String width;
@Schema(description = "图片高度")
private String height;
@Schema(description = "垫图(参考图)base64数组")
private List<String> base64Array;
}

View File

@ -12,8 +12,8 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.ai.AiCommonConstants;
import cn.iocoder.yudao.module.ai.ErrorCodeConstants;
import cn.iocoder.yudao.module.ai.client.MidjourneyProxyClient;
import cn.iocoder.yudao.module.ai.client.enums.MidjourneySubmitCodeEnum;
import cn.iocoder.yudao.module.ai.client.vo.MidjourneyImagineReqVO;
import cn.iocoder.yudao.module.ai.client.vo.MidjourneySubmitCodeEnum;
import cn.iocoder.yudao.module.ai.client.vo.MidjourneySubmitRespVO;
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.*;
import cn.iocoder.yudao.module.ai.dal.dataobject.image.AiImageDO;
@ -157,7 +157,8 @@ public class AiImageServiceImpl implements AiImageService {
// 3调用 MidjourneyProxy 提交任务
MidjourneyImagineReqVO imagineReqVO = BeanUtils.toBean(req, MidjourneyImagineReqVO.class);
imagineReqVO.setNotifyHook(midjourneyNotifyUrl);
imagineReqVO.setState(String.valueOf(aiImageDO.getId()));
// 设置 midjourney 扩展参数通过 --ar 来设置尺寸
imagineReqVO.setState(String.format("--ar %s:%s", req.getWidth(), req.getHeight()));
MidjourneySubmitRespVO submitRespVO = midjourneyProxyClient.imagine(imagineReqVO);
// 4保存任务 id (状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误))