mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
【增加】image 对接 Chatglm 模型
This commit is contained in:
parent
2ae90b9edc
commit
4311fe4517
@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
|
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
|
||||||
|
import cn.iocoder.yudao.framework.ai.core.model.chatglm.ChatGlmImageOptions;
|
||||||
import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi;
|
import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
@ -148,6 +149,10 @@ public class AiImageServiceImpl implements AiImageService {
|
|||||||
.withModel(draw.getModel()).withN(1)
|
.withModel(draw.getModel()).withN(1)
|
||||||
.withHeight(draw.getHeight()).withWidth(draw.getWidth())
|
.withHeight(draw.getHeight()).withWidth(draw.getWidth())
|
||||||
.build();
|
.build();
|
||||||
|
} else if (ObjUtil.equal(draw.getPlatform(), AiPlatformEnum.CHATGLM.getPlatform())) {
|
||||||
|
return ChatGlmImageOptions.builder()
|
||||||
|
.withModel(draw.getModel())
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform());
|
throw new IllegalArgumentException("不支持的 AI 平台:" + draw.getPlatform());
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public enum AiPlatformEnum {
|
|||||||
STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI
|
STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI
|
||||||
MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney
|
MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney
|
||||||
SUNO("Suno", "Suno"), // Suno AI
|
SUNO("Suno", "Suno"), // Suno AI
|
||||||
|
CHATGLM("ChatGlm", "ChatGlm"), // Suno AI
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import cn.hutool.extra.spring.SpringUtil;
|
|||||||
import cn.iocoder.yudao.framework.ai.config.YudaoAiAutoConfiguration;
|
import cn.iocoder.yudao.framework.ai.config.YudaoAiAutoConfiguration;
|
||||||
import cn.iocoder.yudao.framework.ai.config.YudaoAiProperties;
|
import cn.iocoder.yudao.framework.ai.config.YudaoAiProperties;
|
||||||
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
|
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
|
||||||
|
import cn.iocoder.yudao.framework.ai.core.model.chatglm.ChatGlmImageModel;
|
||||||
import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel;
|
import cn.iocoder.yudao.framework.ai.core.model.deepseek.DeepSeekChatModel;
|
||||||
import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi;
|
import cn.iocoder.yudao.framework.ai.core.model.midjourney.api.MidjourneyApi;
|
||||||
import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
|
import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
|
||||||
@ -139,6 +140,8 @@ public class AiModelFactoryImpl implements AiModelFactory {
|
|||||||
return buildOpenAiImageModel(apiKey, url);
|
return buildOpenAiImageModel(apiKey, url);
|
||||||
case STABLE_DIFFUSION:
|
case STABLE_DIFFUSION:
|
||||||
return buildStabilityAiImageModel(apiKey, url);
|
return buildStabilityAiImageModel(apiKey, url);
|
||||||
|
case CHATGLM:
|
||||||
|
return buildChatGlmModel(apiKey);
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
|
throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
|
||||||
}
|
}
|
||||||
@ -273,4 +276,7 @@ public class AiModelFactoryImpl implements AiModelFactory {
|
|||||||
return new StabilityAiImageModel(stabilityAiApi);
|
return new StabilityAiImageModel(stabilityAiApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChatGlmImageModel buildChatGlmModel(String apiKey) {
|
||||||
|
return new ChatGlmImageModel(apiKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user