Commit db7315b8cd79807ef24822e8aa042d6dd88aef17
1 parent
88d7c90c
【增加】百度千帆
Showing
2 changed files
with
8 additions
and
1 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiApiKeyServiceImpl.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/factory/AiModelFactoryImpl.java
| ... | ... | @@ -38,7 +38,9 @@ import org.springframework.ai.openai.api.ApiUtils; |
| 38 | 38 | import org.springframework.ai.openai.api.OpenAiApi; |
| 39 | 39 | import org.springframework.ai.openai.api.OpenAiImageApi; |
| 40 | 40 | import org.springframework.ai.qianfan.QianFanChatModel; |
| 41 | +import org.springframework.ai.qianfan.QianFanImageModel; | |
| 41 | 42 | import org.springframework.ai.qianfan.api.QianFanApi; |
| 43 | +import org.springframework.ai.qianfan.api.QianFanImageApi; | |
| 42 | 44 | import org.springframework.ai.stabilityai.StabilityAiImageModel; |
| 43 | 45 | import org.springframework.ai.stabilityai.api.StabilityAiApi; |
| 44 | 46 | import org.springframework.ai.zhipuai.ZhiPuAiChatModel; |
| ... | ... | @@ -128,6 +130,8 @@ public class AiModelFactoryImpl implements AiModelFactory { |
| 128 | 130 | return buildStabilityAiImageModel(apiKey, url); |
| 129 | 131 | case TONG_YI: |
| 130 | 132 | return SpringUtil.getBean(TongYiImagesModel.class); |
| 133 | + case YI_YAN: | |
| 134 | + return buildQianFanImageModel(apiKey); | |
| 131 | 135 | default: |
| 132 | 136 | throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform)); |
| 133 | 137 | } |
| ... | ... | @@ -242,4 +246,8 @@ public class AiModelFactoryImpl implements AiModelFactory { |
| 242 | 246 | return new StabilityAiImageModel(stabilityAiApi); |
| 243 | 247 | } |
| 244 | 248 | |
| 249 | + private QianFanImageModel buildQianFanImageModel(String key) { | |
| 250 | + List<String> keys = StrUtil.split(key, '|'); | |
| 251 | + return new QianFanImageModel(new QianFanImageApi(keys.get(0), keys.get(1))); | |
| 252 | + } | |
| 245 | 253 | } | ... | ... |