【代码优化】AI:移除 AiModelEnum 枚举

This commit is contained in:
YunaiV 2024-07-04 23:55:05 +08:00
parent 471968eaf2
commit 266b6faa85
5 changed files with 2 additions and 81 deletions

View File

@ -1,73 +0,0 @@
package cn.iocoder.yudao.module.ai.enums.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
// TODO @芋艿可以考虑清理掉
/**
* ai 模型
*
* @author: fansili
* @time: 2024/3/4 12:36
*/
@Getter
@AllArgsConstructor
public enum AiModelEnum {
// open ai
OPEN_AI_GPT_3_5( "GPT3.5", "gpt-3.5-turbo",null),
OPEN_AI_GPT_4("GPT4", "gpt-4-turbo",null),
// 千问付费模型
QWEN_TURBO("通义千问超大规模语言模型", "qwen-turbo", null),
QWEN_PLUS("通义千问超大规模语言模型增强版", "qwen-plus", null),
QWEN_MAX("通义千问千亿级别超大规模语言模型", "qwen-max", null),
QWEN_MAX_0403("通义千问千亿级别超大规模语言模型-0403", "qwen-max-0403", null),
QWEN_MAX_0107("通义千问千亿级别超大规模语言模型-0107", "qwen-max-0107", null),
QWEN_MAX_1201("通义千问千亿级别超大规模语言模型-1201", "qwen-max-1201", null),
QWEN_MAX_LONGCONTEXT("通义千问千亿级别超大规模语言模型-28k tokens", "qwen-max-longcontext", null),
// 千问开源模型
// https://help.aliyun.com/document_detail/2666503.html?spm=a2c4g.2701795.0.0.26eb34dfKzcWN4
QWEN_72B_CHAT("通义千问1.5对外开源的72B规模参数量的经过人类指令对齐的chat模型", "qwen-72b-chat", null),
// 一言模型
ERNIE4_0("ERNIE 4.0", "ERNIE 4.0", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro"),
ERNIE4_3_5_8K("ERNIE-3.5-8K", "ERNIE-3.5-8K", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions"),
ERNIE4_3_5_8K_0205("ERNIE-3.5-8K-0205", "ERNIE-3.5-8K-0205", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-8k-0205"),
ERNIE4_3_5_8K_1222("ERNIE-3.5-8K-1222", "ERNIE-3.5-8K-1222", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-8k-1222"),
ERNIE4_BOT_8K("ERNIE-Bot-8K", "ERNIE-Bot-8K", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_bot_8k"),
ERNIE4_3_5_4K_0205("ERNIE-3.5-4K-0205", "ERNIE-3.5-4K-0205", "/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-4k-0205"),
// 文档地址https://www.xfyun.cn/doc/spark/Web.html#_1-%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E
// general指向V1.5版本;
// generalv2指向V2版本;
// generalv3指向V3版本;
// generalv3.5指向V3.5版本;
XING_HUO_1_5("星火大模型1.5", "general", "/v1.1/chat"),
XING_HUO_2_0("星火大模型2.0", "generalv2", "/v2.1/chat"),
XING_HUO_3_0("星火大模型3.0", "generalv3", "/v3.1/chat"),
XING_HUO_3_5("星火大模型3.5", "generalv3.5", "/v3.5/chat"),
// Suno 模型
SUNO_2( "SUNO-2", "chirp-v2-xxl-alpha",null),
SUNO_3_0( "SUNO-3.0", "chirp-v3-0",null),
SUNO_3_5( "SUNO-3.5", "chirp-v3-5",null),
;
/**
* 模型名字 - 用于展示
*/
private final String name;
/**
* 模型标志 - 用于参数传递
*/
private final String model;
/**
* uri地址
*/
private final String uri;
}

View File

@ -28,7 +28,7 @@ public class AiChatMessageRespVO {
private Long roleId;
@Schema(description = "模型标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "gpt-3.5-turbo")
private String model; // 参见 AiOpenAiModelEnum 枚举类
private String model;
@Schema(description = "模型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123")
private Long modelId;

View File

@ -46,7 +46,7 @@ public class AiSunoGenerateReqVO {
@Schema(description = "模型", requiredMode = Schema.RequiredMode.REQUIRED, example = "chirp-v3.5")
@NotEmpty(message = "模型不能为空")
private String model; // 参见 AiModelEnum 枚举
private String model;
@Schema(description = "音乐风格", example = "[\"pop\",\"jazz\",\"punk\"]")
private List<String> tags;

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.ai.dal.dataobject.chat;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatModelDO;
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
import cn.iocoder.yudao.module.ai.enums.model.AiModelEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -73,8 +72,6 @@ public class AiChatConversationDO extends BaseDO {
private Long modelId;
/**
* 模型标志
*
* 枚举 {@link AiModelEnum}
*/
private String model;

View File

@ -5,7 +5,6 @@ import org.springframework.ai.chat.messages.MessageType;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatModelDO;
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
import cn.iocoder.yudao.module.ai.enums.model.AiModelEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@ -69,8 +68,6 @@ public class AiChatMessageDO extends BaseDO {
/**
* 模型标志
*
* 枚举 {@link AiModelEnum}
*/
private String model;
/**