Forráskód Böngészése

【代码优化】AI:适配 Spring AI 1.0.6 对 ZhiPu 的兼容

YunaiV 5 hónapja
szülő
commit
430dc99d12

+ 6 - 3
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/ZhiPuAiChatModelTests.java

@@ -22,9 +22,12 @@ import java.util.List;
  */
 public class ZhiPuAiChatModelTests {
 
-    private final ZhiPuAiApi zhiPuAiApi = new ZhiPuAiApi("32f84543e54eee31f8d56b2bd6020573.3vh9idLJZ2ZhxDEs");
-    private final ZhiPuAiChatModel chatModel = new ZhiPuAiChatModel(zhiPuAiApi,
-            ZhiPuAiChatOptions.builder().model(ZhiPuAiApi.ChatModel.GLM_4.getName()).build());
+    private final ZhiPuAiChatModel chatModel = new ZhiPuAiChatModel(
+            new ZhiPuAiApi("32f84543e54eee31f8d56b2bd6020573.3vh9idLJZ2ZhxDEs"), // 密钥
+            ZhiPuAiChatOptions.builder()
+                    .model(ZhiPuAiApi.ChatModel.GLM_4.getName()) // 模型
+                    .build()
+    );
 
     @Test
     @Disabled

+ 3 - 3
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/ZhiPuAiImageModelTests.java

@@ -13,9 +13,9 @@ import org.springframework.ai.zhipuai.api.ZhiPuAiImageApi;
  */
 public class ZhiPuAiImageModelTests {
 
-    private final ZhiPuAiImageApi imageApi = new ZhiPuAiImageApi(
-            "78d3228c1d9e5e342a3e1ab349e2dd7b.VXLoq5vrwK2ofboy");
-    private final ZhiPuAiImageModel imageModel = new ZhiPuAiImageModel(imageApi);
+    private final ZhiPuAiImageModel imageModel = new ZhiPuAiImageModel(
+            new ZhiPuAiImageApi("78d3228c1d9e5e342a3e1ab349e2dd7b.VXLoq5vrwK2ofboy") // 密钥
+    );
 
     @Test
     @Disabled