【增加】midjourney 增加版本号设置

This commit is contained in:
cherishsince 2024-05-31 14:25:03 +08:00
parent bd9474994f
commit 47ff5bf814
2 changed files with 8 additions and 3 deletions

View File

@ -26,12 +26,15 @@ public class AiImageMidjourneyImagineReqVO {
@Schema(description = "模型(midjourney、niji)")
private String model;
@Schema(description = "图片宽度")
@Schema(description = "图片宽度 --ar 设置")
private String width;
@Schema(description = "图片高度")
@Schema(description = "图片高度 --ar 设置")
private String height;
@Schema(description = "版本号 --v 设置")
private String version;
@Schema(description = "垫图(参考图)base64数组")
private List<String> base64Array;
}

View File

@ -158,7 +158,9 @@ public class AiImageServiceImpl implements AiImageService {
MidjourneyImagineReqVO imagineReqVO = BeanUtils.toBean(req, MidjourneyImagineReqVO.class);
imagineReqVO.setNotifyHook(midjourneyNotifyUrl);
// 设置 midjourney 扩展参数通过 --ar 来设置尺寸
imagineReqVO.setState(String.format("--ar %s:%s", req.getWidth(), req.getHeight()));
String midjourneySizeParam = String.format("--ar %s:%s", req.getWidth(), req.getHeight());
String midjourneyVersionParam = String.format("--v %s", req.getVersion());
imagineReqVO.setState(midjourneySizeParam.concat(" ").concat(midjourneyVersionParam));
MidjourneySubmitRespVO submitRespVO = midjourneyProxyClient.imagine(imagineReqVO);
// 4保存任务 id (状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误))