【代码评审】AI:qwen 的接入调整

This commit is contained in:
YunaiV 2024-05-18 10:36:25 +08:00
parent 645dfae003
commit f4a0058e88
12 changed files with 22 additions and 24 deletions

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.ai.config;
import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
import org.springframework.ai.chat.ChatClient; import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.StreamingChatClient; 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.xinghuo.XingHuoChatClient;
import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient; import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient;
import org.springframework.ai.ollama.OllamaChatClient; import org.springframework.ai.ollama.OllamaChatClient;

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.framework.ai.config; package cn.iocoder.yudao.framework.ai.config;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import org.springframework.ai.models.tongyi.QianWenChatClient; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatClient;
import org.springframework.ai.models.tongyi.QianWenChatModal; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatModal;
import org.springframework.ai.models.tongyi.QianWenOptions; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenOptions;
import org.springframework.ai.models.tongyi.api.QianWenApi; 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.XingHuoChatClient;
import cn.iocoder.yudao.framework.ai.core.model.xinghuo.XingHuoOptions; 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.xinghuo.api.XingHuoApi;

View File

@ -5,10 +5,9 @@ import lombok.Getter;
// TODO 芋艿这块看看要不要调整下 // TODO 芋艿这块看看要不要调整下
/** /**
* ai 模型平台 * AI 模型平台
* *
* author: fansili * @author fansili
* time: 2024/3/11 10:12
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
@ -18,7 +17,6 @@ public enum AiPlatformEnum {
OLLAMA("Ollama", "Ollama"), OLLAMA("Ollama", "Ollama"),
YI_YAN("YiYan", "文心一言"), // 百度 YI_YAN("YiYan", "文心一言"), // 百度
XING_HUO("XingHuo", "星火"), // 讯飞 XING_HUO("XingHuo", "星火"), // 讯飞
QIAN_WEN("qianwen", "千问"), // 阿里 QIAN_WEN("qianwen", "千问"), // 阿里
OPEN_AI_DALL("dall", "dall"), OPEN_AI_DALL("dall", "dall"),

View File

@ -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.exception.ChatException;
import cn.iocoder.yudao.framework.ai.core.model.tongyi.api.QianWenApi;
import org.springframework.ai.chat.*; import org.springframework.ai.chat.*;
import org.springframework.ai.chat.prompt.ChatOptions; import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.chat.prompt.Prompt; 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 cn.iocoder.yudao.framework.ai.core.model.yiyan.exception.YiYanApiException;
import com.alibaba.dashscope.aigc.generation.GenerationResult; import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.aigc.generation.models.QwenParam; import com.alibaba.dashscope.aigc.generation.models.QwenParam;
@ -24,6 +24,7 @@ import java.time.Duration;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
// TODO @芋艿暂时不需要重构 spring cloud alibaba ai 发布最新的
/** /**
* 阿里 通义千问 client * 阿里 通义千问 client
* <p> * <p>
@ -39,7 +40,6 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient {
private QianWenOptions qianWenOptions; private QianWenOptions qianWenOptions;
public QianWenChatClient() { public QianWenChatClient() {
} }

View File

@ -1,4 +1,4 @@
package org.springframework.ai.models.tongyi; package cn.iocoder.yudao.framework.ai.core.model.tongyi;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

View File

@ -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 org.springframework.ai.chat.prompt.ChatOptions;
import lombok.Data; import lombok.Data;

View File

@ -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 cn.iocoder.yudao.framework.ai.core.exception.AiException;
import com.alibaba.dashscope.aigc.generation.Generation; import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationResult; import com.alibaba.dashscope.aigc.generation.GenerationResult;

View File

@ -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; import com.alibaba.dashscope.aigc.generation.models.QwenParam;

View File

@ -8,4 +8,4 @@
* author: fansili * author: fansili
* time: 2024/3/13 21:05 * time: 2024/3/13 21:05
*/ */
package org.springframework.ai.models.tongyi; package cn.iocoder.yudao.framework.ai.core.model.tongyi;

View File

@ -4,10 +4,10 @@ import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.messages.SystemMessage; import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage; import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt; import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.models.tongyi.QianWenChatClient; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatClient;
import org.springframework.ai.models.tongyi.QianWenChatModal; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenChatModal;
import org.springframework.ai.models.tongyi.QianWenOptions; import cn.iocoder.yudao.framework.ai.core.model.tongyi.QianWenOptions;
import org.springframework.ai.models.tongyi.api.QianWenApi; import cn.iocoder.yudao.framework.ai.core.model.tongyi.api.QianWenApi;
import com.alibaba.dashscope.aigc.generation.GenerationResult; import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.aigc.generation.models.QwenParam; import com.alibaba.dashscope.aigc.generation.models.QwenParam;
import com.alibaba.dashscope.common.Message; import com.alibaba.dashscope.common.Message;