【增加】增加通义万相

This commit is contained in:
cherishsince 2024-07-10 18:53:39 +08:00
parent 4c21ae32fe
commit b6fead81f2
3 changed files with 9 additions and 1 deletions

View File

@ -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",

View File

@ -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());
}

View File

@ -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
;
/**