mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-18 19:20:05 +08:00
【代码优化】AI:图片轮询实现
This commit is contained in:
parent
d860560318
commit
2c61acf913
@ -61,7 +61,7 @@ public class AiImageController {
|
||||
@Operation(summary = "获取【我的】绘图记录列表")
|
||||
@Parameter(name = "ids", required = true, description = "绘画编号数组", example = "1024,2048")
|
||||
public CommonResult<List<AiImageRespVO>> getImageListMyByIds(@RequestParam("ids") List<Long> ids) {
|
||||
List<AiImageDO> imageList = imageService.getImageByIds(ids);
|
||||
List<AiImageDO> imageList = imageService.getImageList(ids);
|
||||
imageList.removeIf(item -> !ObjUtil.equal(getLoginUserId(), item.getUserId()));
|
||||
return success(BeanUtils.toBean(imageList, AiImageRespVO.class));
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDrawReqVO;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageRespVO;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageUpdatePublicStatusReqVO;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.midjourney.AiMidjourneyActionReqVO;
|
||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.midjourney.AiMidjourneyImagineReqVO;
|
||||
@ -39,12 +38,12 @@ public interface AiImageService {
|
||||
AiImageDO getImage(Long id);
|
||||
|
||||
/**
|
||||
* 获得绘图记录 - 多个
|
||||
* 获得绘图列表
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 绘图编号数组
|
||||
* @return 绘图记录列表
|
||||
*/
|
||||
List<AiImageDO> getImageByIds(List<Long> ids);
|
||||
List<AiImageDO> getImageList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 绘制图片
|
||||
|
@ -76,7 +76,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AiImageDO> getImageByIds(List<Long> ids) {
|
||||
public List<AiImageDO> getImageList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
} else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.STABLE_DIFFUSION.getPlatform())) {
|
||||
// https://platform.stability.ai/docs/api-reference#tag/Text-to-Image/operation/textToImage
|
||||
return StabilityAiImageOptions.builder().withModel(draw.getModel())
|
||||
.withHeight(draw.getHeight()).withWidth(draw.getWidth()) // TODO @芋艿:各种参数
|
||||
.withHeight(draw.getHeight()).withWidth(draw.getWidth()) // TODO @范:各种参数的接入
|
||||
.build();
|
||||
}
|
||||
throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform());
|
||||
|
Loading…
Reference in New Issue
Block a user