Commit 5618313d65b342ff2ae413a970e3ad0f93501aa6

Authored by cherishsince
1 parent 8f0c5998

【优化】处理 build xing huo key size 判断问题

yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/factory/AiClientFactoryImpl.java
... ... @@ -20,6 +20,7 @@ import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoApi;
20 20 import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient;
21 21 import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatOptions;
22 22 import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanApi;
  23 +import com.google.cloud.vertexai.VertexAI;
23 24 import org.springframework.ai.autoconfigure.ollama.OllamaAutoConfiguration;
24 25 import org.springframework.ai.autoconfigure.openai.OpenAiAutoConfiguration;
25 26 import org.springframework.ai.chat.StreamingChatClient;
... ... @@ -31,6 +32,8 @@ import org.springframework.ai.openai.OpenAiChatClient;
31 32 import org.springframework.ai.openai.OpenAiChatOptions;
32 33 import org.springframework.ai.openai.api.ApiUtils;
33 34 import org.springframework.ai.openai.api.OpenAiApi;
  35 +import org.springframework.ai.vertexai.gemini.VertexAiGeminiChatClient;
  36 +import org.springframework.ai.vertexai.gemini.VertexAiGeminiChatOptions;
34 37  
35 38 import java.util.List;
36 39  
... ... @@ -57,6 +60,8 @@ public class AiClientFactoryImpl implements AiClientFactory {
57 60 return buildXingHuoChatClient(apiKey);
58 61 case QIAN_WEN:
59 62 return buildQianWenChatClient(apiKey);
  63 + case GEMIR:
  64 + return buildGoogleGemir(apiKey);
60 65 default:
61 66 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
62 67 }
... ... @@ -148,7 +153,7 @@ public class AiClientFactoryImpl implements AiClientFactory {
148 153 */
149 154 private static XingHuoChatClient buildXingHuoChatClient(String key) {
150 155 List<String> keys = StrUtil.split(key, '|');
151   - Assert.equals(keys.size(), 2, "XingHuoChatClient 的密钥需要 (appKey|secretKey) 格式");
  156 + Assert.equals(keys.size(), 3, "XingHuoChatClient 的密钥需要 (appid|appKey|secretKey) 格式");
152 157 String appId = keys.get(0);
153 158 String appKey = keys.get(1);
154 159 String secretKey = keys.get(2);
... ...