Commit 2c61acf913017d22cb26c8225fa89c9ecebca753
1 parent
d8605603
【代码优化】AI:图片轮询实现
Showing
3 changed files
with
7 additions
and
8 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/image/AiImageController.java
| ... | ... | @@ -61,7 +61,7 @@ public class AiImageController { |
| 61 | 61 | @Operation(summary = "获取【我的】绘图记录列表") |
| 62 | 62 | @Parameter(name = "ids", required = true, description = "绘画编号数组", example = "1024,2048") |
| 63 | 63 | public CommonResult<List<AiImageRespVO>> getImageListMyByIds(@RequestParam("ids") List<Long> ids) { |
| 64 | - List<AiImageDO> imageList = imageService.getImageByIds(ids); | |
| 64 | + List<AiImageDO> imageList = imageService.getImageList(ids); | |
| 65 | 65 | imageList.removeIf(item -> !ObjUtil.equal(getLoginUserId(), item.getUserId())); |
| 66 | 66 | return success(BeanUtils.toBean(imageList, AiImageRespVO.class)); |
| 67 | 67 | } | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageService.java
| ... | ... | @@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDrawReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImagePageReqVO; |
| 8 | -import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageRespVO; | |
| 9 | 8 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageUpdatePublicStatusReqVO; |
| 10 | 9 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.midjourney.AiMidjourneyActionReqVO; |
| 11 | 10 | import cn.iocoder.yudao.module.ai.controller.admin.image.vo.midjourney.AiMidjourneyImagineReqVO; |
| ... | ... | @@ -39,12 +38,12 @@ public interface AiImageService { |
| 39 | 38 | AiImageDO getImage(Long id); |
| 40 | 39 | |
| 41 | 40 | /** |
| 42 | - * 获得绘图记录 - 多个 | |
| 41 | + * 获得绘图列表 | |
| 43 | 42 | * |
| 44 | - * @param ids | |
| 45 | - * @return | |
| 43 | + * @param ids 绘图编号数组 | |
| 44 | + * @return 绘图记录列表 | |
| 46 | 45 | */ |
| 47 | - List<AiImageDO> getImageByIds(List<Long> ids); | |
| 46 | + List<AiImageDO> getImageList(List<Long> ids); | |
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | 49 | * 绘制图片 | ... | ... |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| ... | ... | @@ -76,7 +76,7 @@ public class AiImageServiceImpl implements AiImageService { |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | @Override |
| 79 | - public List<AiImageDO> getImageByIds(List<Long> ids) { | |
| 79 | + public List<AiImageDO> getImageList(List<Long> ids) { | |
| 80 | 80 | if (CollUtil.isEmpty(ids)) { |
| 81 | 81 | return Collections.emptyList(); |
| 82 | 82 | } |
| ... | ... | @@ -128,7 +128,7 @@ public class AiImageServiceImpl implements AiImageService { |
| 128 | 128 | } else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.STABLE_DIFFUSION.getPlatform())) { |
| 129 | 129 | // https://platform.stability.ai/docs/api-reference#tag/Text-to-Image/operation/textToImage |
| 130 | 130 | return StabilityAiImageOptions.builder().withModel(draw.getModel()) |
| 131 | - .withHeight(draw.getHeight()).withWidth(draw.getWidth()) // TODO @芋艿:各种参数 | |
| 131 | + .withHeight(draw.getHeight()).withWidth(draw.getWidth()) // TODO @范:各种参数的接入 | |
| 132 | 132 | .build(); |
| 133 | 133 | } |
| 134 | 134 | throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); | ... | ... |