Commit 47ff5bf814490791317f654e9515364fca05aedd
1 parent
bd947499
【增加】midjourney 增加版本号设置
Showing
2 changed files
with
8 additions
and
3 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/vo/AiImageMidjourneyImagineReqVO.java
| ... | ... | @@ -26,12 +26,15 @@ public class AiImageMidjourneyImagineReqVO { |
| 26 | 26 | @Schema(description = "模型(midjourney、niji)") |
| 27 | 27 | private String model; |
| 28 | 28 | |
| 29 | - @Schema(description = "图片宽度") | |
| 29 | + @Schema(description = "图片宽度 --ar 设置") | |
| 30 | 30 | private String width; |
| 31 | 31 | |
| 32 | - @Schema(description = "图片高度") | |
| 32 | + @Schema(description = "图片高度 --ar 设置") | |
| 33 | 33 | private String height; |
| 34 | 34 | |
| 35 | + @Schema(description = "版本号 --v 设置") | |
| 36 | + private String version; | |
| 37 | + | |
| 35 | 38 | @Schema(description = "垫图(参考图)base64数组") |
| 36 | 39 | private List<String> base64Array; |
| 37 | 40 | } | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| ... | ... | @@ -158,7 +158,9 @@ public class AiImageServiceImpl implements AiImageService { |
| 158 | 158 | MidjourneyImagineReqVO imagineReqVO = BeanUtils.toBean(req, MidjourneyImagineReqVO.class); |
| 159 | 159 | imagineReqVO.setNotifyHook(midjourneyNotifyUrl); |
| 160 | 160 | // 设置 midjourney 扩展参数,通过 --ar 来设置尺寸 |
| 161 | - imagineReqVO.setState(String.format("--ar %s:%s", req.getWidth(), req.getHeight())); | |
| 161 | + String midjourneySizeParam = String.format("--ar %s:%s", req.getWidth(), req.getHeight()); | |
| 162 | + String midjourneyVersionParam = String.format("--v %s", req.getVersion()); | |
| 163 | + imagineReqVO.setState(midjourneySizeParam.concat(" ").concat(midjourneyVersionParam)); | |
| 162 | 164 | MidjourneySubmitRespVO submitRespVO = midjourneyProxyClient.imagine(imagineReqVO); |
| 163 | 165 | |
| 164 | 166 | // 4、保存任务 id (状态码: 1(提交成功), 21(已存在), 22(排队中), other(错误)) | ... | ... |