From 2ef64a0a506c02c490f2a625859a09909196d211 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 26 Apr 2024 18:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=80=82=E9=85=8D=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=8D=83=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/chatqianwen/QianWenOptions.java | 5 ---- .../ai/config/YudaoAiAutoConfiguration.java | 9 +++++--- .../ai/config/YudaoAiProperties.java | 23 ++++++------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenOptions.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenOptions.java index eb598d366..bc7564df5 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenOptions.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenOptions.java @@ -18,11 +18,6 @@ import java.util.List; @Accessors public class QianWenOptions implements ChatOptions { - private String appId; - /** - * 是否流式输出, 默认为否。 - */ - private Boolean stream; /** * 用户与模型的对话历史 */ diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java index 483e88477..2eadf156b 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java @@ -44,13 +44,16 @@ public class YudaoAiAutoConfiguration { @ConditionalOnProperty(value = "yudao.ai.qianwen.enable", havingValue = "true") public QianWenChatClient qianWenChatClient(YudaoAiProperties yudaoAiProperties) { YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen(); + QianWenOptions qianWenOptions = new QianWenOptions(); + qianWenOptions.setTopK(qianWenProperties.getTopK()); + qianWenOptions.setTopP(qianWenProperties.getTopP()); + qianWenOptions.setTemperature(qianWenProperties.getTemperature()); return new QianWenChatClient( new QianWenApi( - qianWenProperties.getAgentKey(), + qianWenProperties.getApiKey(), QianWenChatModal.QWEN_72B_CHAT ), - new QianWenOptions() - .setAppId(qianWenProperties.getAppId()) + qianWenOptions ); } diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiProperties.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiProperties.java index 40f310f4e..4ccfb2a4c 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiProperties.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiProperties.java @@ -42,26 +42,15 @@ public class YudaoAiProperties { @Data @Accessors(chain = true) public static class QianWenProperties extends ChatProperties { + /** - * 阿里云:服务器接入点 + * api key */ - private String endpoint = "bailian.cn-beijing.aliyuncs.com"; + private String apiKey; /** - * 阿里云:权限 accessKeyId + * model */ - private String accessKeyId; - /** - * 阿里云:权限 accessKeySecret - */ - private String accessKeySecret; - /** - * 阿里云:agentKey - */ - private String agentKey; - /** - * 阿里云:agentKey(相当于应用id) - */ - private String appId; + private YiYanChatModel model; } @@ -93,5 +82,7 @@ public class YudaoAiProperties { * token 刷新时间(默认 86400 = 24小时) */ private int refreshTokenSecondTime = 86400; + + private YiYanChatModel model; } }