From f4a0058e88ab97b6c4af52a155ff1975dd7129b5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 18 May 2024 10:36:25 +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=9Aqwen=20=E7=9A=84=E6=8E=A5=E5=85=A5=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/ai/config/AiChatClientFactory.java | 2 +- .../framework/ai/config/YudaoAiAutoConfiguration.java | 8 ++++---- .../yudao/framework/ai/core/enums/AiPlatformEnum.java | 6 ++---- .../ai/core/model}/tongyi/QianWenChatClient.java | 6 +++--- .../framework/ai/core/model}/tongyi/QianWenChatModal.java | 2 +- .../framework/ai/core/model}/tongyi/QianWenOptions.java | 2 +- .../framework/ai/core/model}/tongyi/api/QianWenApi.java | 4 ++-- .../ai/core/model}/tongyi/api/QianWenChatCompletion.java | 2 +- .../model}/tongyi/api/QianWenChatCompletionMessage.java | 2 +- .../model}/tongyi/api/QianWenChatCompletionRequest.java | 2 +- .../framework/ai/core/model}/tongyi/package-info.java | 2 +- .../yudao/framework/ai/chat/QianWenChatClientTests.java | 8 ++++---- 12 files changed, 22 insertions(+), 24 deletions(-) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/tongyi/QianWenChatClient.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}/tongyi/QianWenChatModal.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}/tongyi/QianWenOptions.java (98%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/tongyi/api/QianWenApi.java (94%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/tongyi/api/QianWenChatCompletion.java (60%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/tongyi/api/QianWenChatCompletionMessage.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}/tongyi/api/QianWenChatCompletionRequest.java (82%) rename yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/{org/springframework/ai/models => cn/iocoder/yudao/framework/ai/core/model}/tongyi/package-info.java (85%) 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 14dc2b8b5..e7a64c214 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 @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.ai.config; 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 cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatClient; 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; 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 13f8f71ed..f942b12bd 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 @@ -1,10 +1,10 @@ package cn.iocoder.yudao.framework.ai.config; import cn.hutool.core.io.IoUtil; -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 cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatClient; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatModal; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenOptions; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.api.QianWenApi; 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; 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 a85fffe9a..fc41069a9 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 @@ -5,10 +5,9 @@ import lombok.Getter; // TODO 芋艿:这块,看看要不要调整下; /** - * ai 模型平台 + * AI 模型平台 * - * author: fansili - * time: 2024/3/11 10:12 + * @author fansili */ @Getter @AllArgsConstructor @@ -18,7 +17,6 @@ public enum AiPlatformEnum { OLLAMA("Ollama", "Ollama"), YI_YAN("YiYan", "文心一言"), // 百度 XING_HUO("XingHuo", "星火"), // 讯飞 - QIAN_WEN("qianwen", "千问"), // 阿里 OPEN_AI_DALL("dall", "dall"), diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatClient.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatClient.java similarity index 96% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatClient.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatClient.java index 31e60d119..85fa771bd 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatClient.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatClient.java @@ -1,10 +1,10 @@ -package org.springframework.ai.models.tongyi; +package cn.iocoder.yudao.framework.ai.core.model.tongyi; import cn.iocoder.yudao.framework.ai.core.exception.ChatException; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.api.QianWenApi; import org.springframework.ai.chat.*; import org.springframework.ai.chat.prompt.ChatOptions; import org.springframework.ai.chat.prompt.Prompt; -import org.springframework.ai.models.tongyi.api.QianWenApi; import cn.iocoder.yudao.framework.ai.core.model.yiyan.exception.YiYanApiException; import com.alibaba.dashscope.aigc.generation.GenerationResult; import com.alibaba.dashscope.aigc.generation.models.QwenParam; @@ -24,6 +24,7 @@ import java.time.Duration; import java.util.List; import java.util.stream.Collectors; +// TODO @芋艿:暂时不需要重构;等 spring cloud alibaba 的 ai 发布最新的 /** * 阿里 通义千问 client *

@@ -39,7 +40,6 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient { private QianWenOptions qianWenOptions; - public QianWenChatClient() { } diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatModal.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatModal.java similarity index 96% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatModal.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatModal.java index 9474a8df5..e1cbcd5de 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenChatModal.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenChatModal.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.tongyi; +package cn.iocoder.yudao.framework.ai.core.model.tongyi; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenOptions.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenOptions.java similarity index 98% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenOptions.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenOptions.java index 39db36608..b6dba53c9 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/QianWenOptions.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/QianWenOptions.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.tongyi; +package cn.iocoder.yudao.framework.ai.core.model.tongyi; 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/tongyi/api/QianWenApi.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenApi.java similarity index 94% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenApi.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenApi.java index 2e905114f..6d3e7cd41 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenApi.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenApi.java @@ -1,6 +1,6 @@ -package org.springframework.ai.models.tongyi.api; +package cn.iocoder.yudao.framework.ai.core.model.tongyi.api; -import org.springframework.ai.models.tongyi.QianWenChatModal; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatModal; import cn.iocoder.yudao.framework.ai.core.exception.AiException; import com.alibaba.dashscope.aigc.generation.Generation; import com.alibaba.dashscope.aigc.generation.GenerationResult; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletion.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletion.java similarity index 60% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletion.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletion.java index 1c3c6109b..1e7748ddc 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletion.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletion.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.tongyi.api; +package cn.iocoder.yudao.framework.ai.core.model.tongyi.api; /** diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionMessage.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionMessage.java similarity index 61% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionMessage.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionMessage.java index 4e5d02323..318829bb4 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionMessage.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionMessage.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.tongyi.api; +package cn.iocoder.yudao.framework.ai.core.model.tongyi.api; /** * author: fansili diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionRequest.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionRequest.java similarity index 82% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionRequest.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionRequest.java index 04b69848f..b1d72d15f 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/api/QianWenChatCompletionRequest.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/api/QianWenChatCompletionRequest.java @@ -1,4 +1,4 @@ -package org.springframework.ai.models.tongyi.api; +package cn.iocoder.yudao.framework.ai.core.model.tongyi.api; import com.alibaba.dashscope.aigc.generation.models.QwenParam; diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/package-info.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/package-info.java similarity index 85% rename from yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/package-info.java rename to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/package-info.java index 8d7793b34..11ed0c113 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/tongyi/package-info.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/tongyi/package-info.java @@ -8,4 +8,4 @@ * author: fansili * time: 2024/3/13 21:05 */ -package org.springframework.ai.models.tongyi; \ No newline at end of file +package cn.iocoder.yudao.framework.ai.core.model.tongyi; \ No newline at end of file diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/QianWenChatClientTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/QianWenChatClientTests.java index 99e2b5f7a..a003d1bb7 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/QianWenChatClientTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/QianWenChatClientTests.java @@ -4,10 +4,10 @@ import org.springframework.ai.chat.ChatResponse; 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.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 cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatClient; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatModal; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenOptions; +import cn.iocoder.yudao.framework.ai.core.model.tongyi.api.QianWenApi; import com.alibaba.dashscope.aigc.generation.GenerationResult; import com.alibaba.dashscope.aigc.generation.models.QwenParam; import com.alibaba.dashscope.common.Message;