feat: 添加自动获取高优先级模型和服务的逻辑;

This commit is contained in:
likunlong
2025-08-18 14:30:08 +08:00
committed by Administrator
parent b696fde881
commit 4f7ad59e46
5 changed files with 186 additions and 63 deletions

View File

@@ -76,6 +76,11 @@ public class ChatModel extends BaseEntity {
*/
private String apiKey;
/**
* 优先级
*/
private Integer priority;
/**
* 备注
*/

View File

@@ -74,6 +74,11 @@ public class ChatModelBo extends BaseEntity {
@NotBlank(message = "请求地址不能为空", groups = { AddGroup.class, EditGroup.class })
private String apiHost;
/**
* 优先级
*/
private Integer priority;
/**
* 密钥
*/

View File

@@ -57,6 +57,12 @@ public interface IChatModelService {
* 通过模型分类获取模型信息
*/
ChatModelVo selectModelByCategory(String image);
/**
* 通过模型分类获取优先级最高的模型信息
*/
ChatModelVo selectModelByCategoryWithHighestPriority(String category);
/**
* 获取ppt模型信息
*/

View File

@@ -136,6 +136,19 @@ public class ChatModelServiceImpl implements IChatModelService {
public ChatModelVo selectModelByCategory(String category) {
return baseMapper.selectVoOne(Wrappers.<ChatModel>lambdaQuery().eq(ChatModel::getCategory, category));
}
/**
* 通过模型分类获取优先级最高的模型信息
*/
@Override
public ChatModelVo selectModelByCategoryWithHighestPriority(String category) {
return baseMapper.selectVoOne(
Wrappers.<ChatModel>lambdaQuery()
.eq(ChatModel::getCategory, category)
.orderByDesc(ChatModel::getPriority)
.last("LIMIT 1")
);
}
@Override
public ChatModel getPPT() {