mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
角色增加 更新
This commit is contained in:
parent
4cc87539d8
commit
c44f558e3d
@ -22,6 +22,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
|
||||
ErrorCode AI_CHAT_CONTINUE_NOT_EXIST = new ErrorCode(1_022_000_020, "chat对话不存在!");;
|
||||
ErrorCode AI_CHAT_ROLE_NOT_EXIST = new ErrorCode(1_022_000_020, "chatRole不存在!");;
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.ai.convert;
|
||||
import cn.iocoder.yudao.module.ai.dal.dataobject.AiChatRoleDO;
|
||||
import cn.iocoder.yudao.module.ai.vo.ChatRoleAddReq;
|
||||
import cn.iocoder.yudao.module.ai.vo.ChatRoleListRes;
|
||||
import cn.iocoder.yudao.module.ai.vo.ChatRoleUpdateReq;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@ -35,4 +36,12 @@ public interface ChatRoleConvert {
|
||||
* @return
|
||||
*/
|
||||
AiChatRoleDO convertAiChatRoleDO(ChatRoleAddReq req);
|
||||
|
||||
/**
|
||||
* 转换 - AiChatRoleDO
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
AiChatRoleDO convertAiChatRoleDO(ChatRoleUpdateReq req);
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package cn.iocoder.yudao.module.ai.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.ai.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.ai.convert.ChatRoleConvert;
|
||||
import cn.iocoder.yudao.module.ai.dal.dataobject.AiChatRoleDO;
|
||||
import cn.iocoder.yudao.module.ai.enums.ChatRoleClassifyEnum;
|
||||
@ -66,7 +68,18 @@ public class ChatRoleServiceImpl implements ChatRoleService {
|
||||
|
||||
@Override
|
||||
public void update(ChatRoleUpdateReq req) {
|
||||
|
||||
// 转换enum,并校验enum
|
||||
ChatRoleClassifyEnum.valueOfClassify(req.getClassify());
|
||||
ChatRoleVisibilityEnum.valueOfType(req.getVisibility());
|
||||
ChatRoleSourceEnum.valueOfType(req.getRoleSource());
|
||||
// 检查角色是否存在
|
||||
AiChatRoleDO aiChatRoleDO = aiChatRoleMapper.selectById(req.getId());
|
||||
if (aiChatRoleDO == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AI_CHAT_ROLE_NOT_EXIST);
|
||||
}
|
||||
// 转换do
|
||||
AiChatRoleDO updateChatRole = ChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
||||
aiChatRoleMapper.updateById(updateChatRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ai.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ -15,6 +16,44 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
public class ChatRoleUpdateReq extends PageParam {
|
||||
|
||||
@Schema(description = "查询")
|
||||
private String search;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "模型编号,关联到角色使用的特定模型")
|
||||
private String modelId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色名,角色的显示名称")
|
||||
private String roleName;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色介绍,详细描述角色的功能或用途")
|
||||
private String roleIntroduce;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色来源,如 system(系统预置)、customer(用户自定义)")
|
||||
private String roleSource;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "分类,角色所属的类别,如娱乐、创作等")
|
||||
private String classify;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "发布状态,0表示仅自己可见,1表示公开,2表示禁用")
|
||||
private String visibility;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "生成时的Top-K采样候选集大小")
|
||||
private Double topK;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "生成时使用的核采样方法的概率阈值")
|
||||
private Double topP;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "用于控制随机性和多样性的温度参数")
|
||||
private Double temperature;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user