Commit b6fead81f2133d89026b65f0c839b7880a0ef941
1 parent
4c21ae32
【增加】增加通义万相
Showing
3 changed files
with
9 additions
and
1 deletions
script/idea/http-client.env.json
| 1 | { | 1 | { |
| 2 | "local": { | 2 | "local": { |
| 3 | "baseUrl": "http://127.0.0.1:48080/admin-api", | 3 | "baseUrl": "http://127.0.0.1:48080/admin-api", |
| 4 | - "token": "test1", | 4 | + "token": "Bearer 1c2ce60de96a4fb0bf5bea9604099a3d", |
| 5 | "adminTenentId": "1", | 5 | "adminTenentId": "1", |
| 6 | 6 | ||
| 7 | "appApi": "http://127.0.0.1:48080/app-api", | 7 | "appApi": "http://127.0.0.1:48080/app-api", |
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java
| @@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.ai.dal.mysql.image.AiImageMapper; | @@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.ai.dal.mysql.image.AiImageMapper; | ||
| 23 | import cn.iocoder.yudao.module.ai.enums.image.AiImageStatusEnum; | 23 | import cn.iocoder.yudao.module.ai.enums.image.AiImageStatusEnum; |
| 24 | import cn.iocoder.yudao.module.ai.service.model.AiApiKeyService; | 24 | import cn.iocoder.yudao.module.ai.service.model.AiApiKeyService; |
| 25 | import cn.iocoder.yudao.module.infra.api.file.FileApi; | 25 | import cn.iocoder.yudao.module.infra.api.file.FileApi; |
| 26 | +import com.alibaba.cloud.ai.tongyi.image.TongYiImagesOptions; | ||
| 26 | import jakarta.annotation.Resource; | 27 | import jakarta.annotation.Resource; |
| 27 | import lombok.extern.slf4j.Slf4j; | 28 | import lombok.extern.slf4j.Slf4j; |
| 28 | import org.springframework.ai.image.ImageModel; | 29 | import org.springframework.ai.image.ImageModel; |
| @@ -136,6 +137,11 @@ public class AiImageServiceImpl implements AiImageService { | @@ -136,6 +137,11 @@ public class AiImageServiceImpl implements AiImageService { | ||
| 136 | .withStylePreset(String.valueOf(draw.getOptions().get("stylePreset"))) | 137 | .withStylePreset(String.valueOf(draw.getOptions().get("stylePreset"))) |
| 137 | .withClipGuidancePreset(String.valueOf(draw.getOptions().get("clipGuidancePreset"))) | 138 | .withClipGuidancePreset(String.valueOf(draw.getOptions().get("clipGuidancePreset"))) |
| 138 | .build(); | 139 | .build(); |
| 140 | + } else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.TONG_YI_WAN_XIANG.getPlatform())) { | ||
| 141 | + return TongYiImagesOptions.builder() | ||
| 142 | + .withModel(draw.getModel()).withN(Integer.valueOf(draw.getOptions().get("n"))) | ||
| 143 | + .withHeight(draw.getHeight()).withWidth(draw.getWidth()) | ||
| 144 | + .build(); | ||
| 139 | } | 145 | } |
| 140 | throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); | 146 | throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); |
| 141 | } | 147 | } |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java
| @@ -28,6 +28,8 @@ public enum AiPlatformEnum { | @@ -28,6 +28,8 @@ public enum AiPlatformEnum { | ||
| 28 | STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI | 28 | STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI |
| 29 | MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney | 29 | MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney |
| 30 | SUNO("Suno", "Suno"), // Suno AI | 30 | SUNO("Suno", "Suno"), // Suno AI |
| 31 | + TONG_YI_WAN_XIANG("TongYiWanXiang", "通义万相"), // Suno AI | ||
| 32 | + | ||
| 31 | ; | 33 | ; |
| 32 | 34 | ||
| 33 | /** | 35 | /** |