From b6fead81f2133d89026b65f0c839b7880a0ef941 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 10 Jul 2024 18:53:39 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=80=9A=E4=B9=89=E4=B8=87=E7=9B=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/idea/http-client.env.json | 2 +- .../yudao/module/ai/service/image/AiImageServiceImpl.java | 6 ++++++ .../yudao/framework/ai/core/enums/AiPlatformEnum.java | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/script/idea/http-client.env.json b/script/idea/http-client.env.json index 4a4cb5221..17dd0d50d 100644 --- a/script/idea/http-client.env.json +++ b/script/idea/http-client.env.json @@ -1,7 +1,7 @@ { "local": { "baseUrl": "http://127.0.0.1:48080/admin-api", - "token": "test1", + "token": "Bearer 1c2ce60de96a4fb0bf5bea9604099a3d", "adminTenentId": "1", "appApi": "http://127.0.0.1:48080/app-api", diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java index 27c0978f1..0d9d467e6 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/AiImageServiceImpl.java +++ b/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; import cn.iocoder.yudao.module.ai.enums.image.AiImageStatusEnum; import cn.iocoder.yudao.module.ai.service.model.AiApiKeyService; import cn.iocoder.yudao.module.infra.api.file.FileApi; +import com.alibaba.cloud.ai.tongyi.image.TongYiImagesOptions; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.ai.image.ImageModel; @@ -136,6 +137,11 @@ public class AiImageServiceImpl implements AiImageService { .withStylePreset(String.valueOf(draw.getOptions().get("stylePreset"))) .withClipGuidancePreset(String.valueOf(draw.getOptions().get("clipGuidancePreset"))) .build(); + } else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.TONG_YI_WAN_XIANG.getPlatform())) { + return TongYiImagesOptions.builder() + .withModel(draw.getModel()).withN(Integer.valueOf(draw.getOptions().get("n"))) + .withHeight(draw.getHeight()).withWidth(draw.getWidth()) + .build(); } throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform()); } diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java index fc1e9f429..dea5ea4db 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java +++ b/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 { STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney SUNO("Suno", "Suno"), // Suno AI + TONG_YI_WAN_XIANG("TongYiWanXiang", "通义万相"), // Suno AI + ; /**