mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
【代码评审】AI:qwen 的接入调整
This commit is contained in:
parent
645dfae003
commit
f4a0058e88
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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"),
|
||||||
|
@ -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() {
|
||||||
}
|
}
|
||||||
|
|
@ -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;
|
@ -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;
|
@ -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;
|
@ -1,4 +1,4 @@
|
|||||||
package org.springframework.ai.models.tongyi.api;
|
package cn.iocoder.yudao.framework.ai.core.model.tongyi.api;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package org.springframework.ai.models.tongyi.api;
|
package cn.iocoder.yudao.framework.ai.core.model.tongyi.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* author: fansili
|
* author: fansili
|
@ -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;
|
||||||
|
|
@ -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;
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user