From 645dfae003c723dd268ce0cacc0f0bfaea1a8314 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 18 May 2024 10:15:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91AI=EF=BC=9A=E8=AE=AF=E9=A3=9E=E6=98=9F=E7=81=AB?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=85=A5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/ai/config/AiChatClientFactory.java | 6 ++-- .../module/ai/dal/vo/AiChatModalConfigVO.java | 2 +- .../ai/config/YudaoAiAutoConfiguration.java | 6 ++-- .../ai/config/YudaoAiImageProperties.java | 4 +-- .../ai/config/YudaoAiProperties.java | 3 +- .../ai/core/enums/AiPlatformEnum.java | 13 ++++++-- .../model}/xinghuo/XingHuoChatClient.java | 9 +++--- .../core/model}/xinghuo/XingHuoChatModel.java | 2 +- .../core/model}/xinghuo/XingHuoOptions.java | 2 +- .../core/model}/xinghuo/api/XingHuoApi.java | 5 +-- .../xinghuo/api/XingHuoChatCompletion.java | 2 +- .../api/XingHuoChatCompletionMessage.java | 2 +- .../api/XingHuoChatCompletionRequest.java | 2 +- .../ai/chat/XingHuoChatClientMainTests.java | 4 +-- .../ai/chat/XingHuoChatClientTests.java | 8 ++--- .../framework/ai/chat/XingHuoOkHttpTests.java | 6 ++-- .../src/main/resources/application-local.yaml | 31 ------------------- .../src/main/resources/application.yaml | 31 ++++++++++++++++++- 18 files changed, 72 insertions(+), 66 deletions(-) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/XingHuoChatClient.java (93%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/XingHuoChatModel.java (96%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/XingHuoOptions.java (96%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/api/XingHuoApi.java (96%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/api/XingHuoChatCompletion.java (93%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/api/XingHuoChatCompletionMessage.java (61%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/xinghuo/api/XingHuoChatCompletionRequest.java (97%) diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/config/AiChatClientFactory.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/config/AiChatClientFactory.java index d5863dbc2..14dc2b8b5 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/config/AiChatClientFactory.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/config/AiChatClientFactory.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; import org.springframework.ai.chat.ChatClient; import org.springframework.ai.chat.StreamingChatClient; import org.springframework.ai.models.tongyi.QianWenChatClient; -import org.springframework.ai.models.xinghuo.XingHuoChatClient; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatClient; import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient; import org.springframework.ai.ollama.OllamaChatClient; import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +27,7 @@ public class AiChatClientFactory { public ChatClient getChatClient(AiPlatformEnum platformEnum) { if (AiPlatformEnum.QIAN_WEN == platformEnum) { return applicationContext.getBean(QianWenChatClient.class); - } else if (AiPlatformEnum.YIYAN == platformEnum) { + } else if (AiPlatformEnum.YI_YAN == platformEnum) { return applicationContext.getBean(YiYanChatClient.class); } else if (AiPlatformEnum.XING_HUO == platformEnum) { return applicationContext.getBean(XingHuoChatClient.class); @@ -42,7 +42,7 @@ public class AiChatClientFactory { // } if (AiPlatformEnum.QIAN_WEN == platformEnum) { return applicationContext.getBean(QianWenChatClient.class); - } else if (AiPlatformEnum.YIYAN == platformEnum) { + } else if (AiPlatformEnum.YI_YAN == platformEnum) { return applicationContext.getBean(YiYanChatClient.class); } else if (AiPlatformEnum.XING_HUO == platformEnum) { return applicationContext.getBean(XingHuoChatClient.class); diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/vo/AiChatModalConfigVO.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/vo/AiChatModalConfigVO.java index 723e5338f..4ed060e22 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/vo/AiChatModalConfigVO.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/vo/AiChatModalConfigVO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.ai.dal.vo; import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; import lombok.Data; import lombok.experimental.Accessors; -import org.springframework.ai.models.xinghuo.XingHuoChatModel; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanChatModel; /** 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 67226ec60..13f8f71ed 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 @@ -5,9 +5,9 @@ import org.springframework.ai.models.tongyi.QianWenChatClient; import org.springframework.ai.models.tongyi.QianWenChatModal; import org.springframework.ai.models.tongyi.QianWenOptions; import org.springframework.ai.models.tongyi.api.QianWenApi; -import org.springframework.ai.models.xinghuo.XingHuoChatClient; -import org.springframework.ai.models.xinghuo.XingHuoOptions; -import org.springframework.ai.models.xinghuo.api.XingHuoApi; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatClient; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoOptions; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoApi; import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient; import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatOptions; import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanApi; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiImageProperties.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiImageProperties.java index 1e6d9d9ec..ebae45ff1 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiImageProperties.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiImageProperties.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.framework.ai.config; import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; -import org.springframework.ai.models.xinghuo.XingHuoChatModel; -import org.springframework.ai.models.xinghuo.XingHuoOptions; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoOptions; import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanChatModel; import lombok.Data; import lombok.experimental.Accessors; 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 62bd1318d..16a6bc40e 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 @@ -1,7 +1,7 @@ package cn.iocoder.yudao.framework.ai.config; import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; -import org.springframework.ai.models.xinghuo.XingHuoChatModel; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanChatModel; import cn.iocoder.yudao.framework.ai.core.enums.OpenAiImageModelEnum; import cn.iocoder.yudao.framework.ai.core.enums.OpenAiImageStyleEnum; @@ -21,7 +21,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "yudao.ai") public class YudaoAiProperties { - private String initSource; private QianWenProperties qianwen; private XingHuoProperties xinghuo; private YiYanProperties yiyan; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java index cd60cc990..a85fffe9a 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java @@ -16,16 +16,23 @@ public enum AiPlatformEnum { OPENAI("OpenAI", "OpenAI"), OLLAMA("Ollama", "Ollama"), - YIYAN("YiYan", "文心一言"), + YI_YAN("YiYan", "文心一言"), // 百度 + XING_HUO("XingHuo", "星火"), // 讯飞 + + QIAN_WEN("qianwen", "千问"), // 阿里 - QIAN_WEN("qianwen", "千问"), - XING_HUO("xinghuo", "星火"), OPEN_AI_DALL("dall", "dall"), MIDJOURNEY("midjourney", "midjourney"), ; + /** + * 平台 + */ private final String platform; + /** + * 平台名 + */ private final String name; // public static List CHAT_PLATFORM_LIST = Lists.newArrayList( diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatClient.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatClient.java similarity index 93% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatClient.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatClient.java index 0010a75fa..5537fc1eb 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatClient.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatClient.java @@ -1,14 +1,14 @@ -package org.springframework.ai.models.xinghuo; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.exceptions.ExceptionUtil; import cn.iocoder.yudao.framework.ai.core.exception.ChatException; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoApi; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletion; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletionRequest; import org.springframework.ai.chat.*; import org.springframework.ai.chat.prompt.ChatOptions; import org.springframework.ai.chat.prompt.Prompt; -import org.springframework.ai.models.xinghuo.api.XingHuoApi; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletion; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletionRequest; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.retry.RetryCallback; @@ -21,6 +21,7 @@ import java.time.Duration; import java.util.List; import java.util.stream.Collectors; +// TODO @fan:参考 yiyan 的修改建议,调整下 xinghuo 的实现;可以等 yiyan 修改完建议,然后我 review 完,再改这个哈; /** * 讯飞星火 client *

diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatModel.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java similarity index 96% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatModel.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java index 859e41c03..e9ef5ef35 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoChatModel.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoChatModel.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.xinghuo; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo; import lombok.Getter; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoOptions.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoOptions.java similarity index 96% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoOptions.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoOptions.java index bdc671092..cb4753833 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/XingHuoOptions.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/XingHuoOptions.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.xinghuo; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo; import org.springframework.ai.chat.prompt.ChatOptions; import lombok.Data; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoApi.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoApi.java similarity index 96% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoApi.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoApi.java index 027e8a2d2..b267de84c 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoApi.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoApi.java @@ -1,8 +1,8 @@ -package org.springframework.ai.models.xinghuo.api; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; -import org.springframework.ai.models.xinghuo.XingHuoChatModel; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; import lombok.Data; import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; @@ -21,6 +21,7 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; +// TODO @fan:讯飞使用 spring websocket 接入,还是 okhttp?确认了,未使用的最好删除下,反正 git 也能找回 history /** * 讯飞星火 属性、api *

diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletion.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletion.java similarity index 93% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletion.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletion.java index e419d522e..46aff8717 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletion.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletion.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.xinghuo.api; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; import lombok.Data; import lombok.experimental.Accessors; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionMessage.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionMessage.java similarity index 61% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionMessage.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionMessage.java index f0e0f8d1e..f527b10d4 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionMessage.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionMessage.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.xinghuo.api; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; /** * author: fansili diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionRequest.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionRequest.java similarity index 97% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionRequest.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionRequest.java index 3f2b211ff..f3ca1eb30 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/xinghuo/api/XingHuoChatCompletionRequest.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XingHuoChatCompletionRequest.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.xinghuo.api; +package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; import lombok.Data; import lombok.Getter; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientMainTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientMainTests.java index 77cf9effc..524bd3e0d 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientMainTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientMainTests.java @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.ai.chat; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletion; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletionRequest; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletion; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletionRequest; import org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient; import org.springframework.web.reactive.socket.client.WebSocketClient; import reactor.core.publisher.Flux; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java index 44793907e..8d9cb38e0 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java @@ -5,10 +5,10 @@ import org.springframework.ai.chat.messages.Message; import org.springframework.ai.chat.messages.SystemMessage; import org.springframework.ai.chat.messages.UserMessage; import org.springframework.ai.chat.prompt.Prompt; -import org.springframework.ai.models.xinghuo.XingHuoChatClient; -import org.springframework.ai.models.xinghuo.XingHuoChatModel; -import org.springframework.ai.models.xinghuo.XingHuoOptions; -import org.springframework.ai.models.xinghuo.api.XingHuoApi; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatClient; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatModel; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoOptions; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoApi; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Flux; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoOkHttpTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoOkHttpTests.java index f45f96412..5a087412b 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoOkHttpTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoOkHttpTests.java @@ -2,9 +2,9 @@ package cn.iocoder.yudao.framework.ai.chat; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; -import org.springframework.ai.models.xinghuo.XingHuoChatClient; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletion; -import org.springframework.ai.models.xinghuo.api.XingHuoChatCompletionRequest; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoChatClient; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletion; +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XingHuoChatCompletionRequest; import okhttp3.*; import org.jetbrains.annotations.NotNull; diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 93302bddf..99c888f31 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -209,37 +209,6 @@ wx: # 芋道配置项,设置当前项目所有自定义的配置 yudao: - ai: - initSource: yaml - qianwen: - enable: true - aiPlatform: QIAN_WEN - max-tokens: 1500 - temperature: 0.85 - topP: 0.8 - topK: 0 - api-key: sk-Zsd81gZYg7 - xinghuo: - enable: true - aiPlatform: XING_HUO - max-tokens: 1500 - temperature: 0.85 - topP: 0.8 - topK: 0 - appId: 13c8cca6 - appKey: cb6415c19d6162cda07b47316fcb0416 - secretKey: Y2JiYTIxZjA3MDMxMjNjZjQzYzVmNzdh - model: XING_HUO_3_5 - openAiImage: - enable: true - api-key: ${OPEN_AI_KEY} - model: dall_e_2 - style: vivid - midjourney: - enable: true - token: MTE4MjE3MjY2MjkxNTY3ODIzOA.GEV1SG.c49F8lZoGCUHwsj8O0UdodmM6nyQHvuD2fXflw - guild-id: 1237948819677904956 - channel-id: 1237948819677904960 captcha: enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试; security: diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 52dea3fda..549fd9edd 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -153,7 +153,7 @@ spring.ai: yudao.ai: yiyan: enable: true - aiPlatform: YIYAN # TODO @fan:建议每个都独立配置属性类 + aiPlatform: YI_YAN # TODO @fan:建议每个都独立配置属性类 max-tokens: 1500 temperature: 0.85 topP: 0.8 @@ -162,6 +162,35 @@ yudao.ai: secretKey: R9mYF9dl9KASgi5RUq0FQt3wRisSnOcK refreshTokenSecondTime: 86400 model: ERNIE4_3_5_8K + xinghuo: + enable: true + aiPlatform: XING_HUO # TODO @fan:建议每个都独立配置属性类 + max-tokens: 1500 + temperature: 0.85 + topP: 0.8 + topK: 0 + appId: 13c8cca6 + appKey: cb6415c19d6162cda07b47316fcb0416 + secretKey: Y2JiYTIxZjA3MDMxMjNjZjQzYzVmNzdh + model: XING_HUO_3_5 + qianwen: + enable: true + aiPlatform: QIAN_WEN + max-tokens: 1500 + temperature: 0.85 + topP: 0.8 + topK: 0 + api-key: sk-Zsd81gZYg7 + openAiImage: + enable: true + api-key: ${OPEN_AI_KEY} + model: dall_e_2 + style: vivid + midjourney: + enable: true + token: MTE4MjE3MjY2MjkxNTY3ODIzOA.GEV1SG.c49F8lZoGCUHwsj8O0UdodmM6nyQHvuD2fXflw + guild-id: 1237948819677904956 + channel-id: 1237948819677904960 --- #################### 芋道相关配置 ####################