mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 11:11:55 +08:00
增加 ai modal 添加模型
This commit is contained in:
parent
2fde9b124d
commit
77f3226d27
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.ai.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ai modal disable
|
||||
*
|
||||
* @author fansili
|
||||
* @time 2024/4/24 20:15
|
||||
* @since 1.0
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum AiChatModalDisableEnum {
|
||||
|
||||
NO(0, "未禁用"),
|
||||
YES(1, "禁用"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private Integer value;
|
||||
|
||||
private String name;
|
||||
}
|
@ -44,7 +44,7 @@ public class AiChatModalController {
|
||||
}
|
||||
|
||||
@Operation(summary = "ai模型 - 模型照片上传")
|
||||
@PutMapping("/modal/{id}/updateImage")
|
||||
@PostMapping("/modal/{id}/updateImage")
|
||||
public CommonResult updateImage(@PathVariable("id") Long id,
|
||||
MultipartFile file) {
|
||||
// todo yunai 文件上传这里放哪里
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.ai.convert;
|
||||
|
||||
import cn.iocoder.yudao.module.ai.dal.dataobject.AiChatModalDO;
|
||||
import cn.iocoder.yudao.module.ai.vo.AiChatModalAddReq;
|
||||
import cn.iocoder.yudao.module.ai.vo.AiChatModalListRes;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@ -19,6 +20,19 @@ public interface ChatModalConvert {
|
||||
|
||||
ChatModalConvert INSTANCE = Mappers.getMapper(ChatModalConvert.class);
|
||||
|
||||
|
||||
/**
|
||||
* 转换 - AiChatModalListRes
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
List<AiChatModalListRes> convertAiChatModalListRes(List<AiChatModalDO> list);
|
||||
|
||||
/**
|
||||
* 转换 - AiChatModalDO
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
AiChatModalDO convertAiChatModalDO(AiChatModalAddReq req);
|
||||
}
|
||||
|
@ -35,10 +35,6 @@ public class AiChatModalDO extends BaseDO {
|
||||
* 模型配置JSON
|
||||
*/
|
||||
private String modelConfig;
|
||||
/**
|
||||
* 模型图片
|
||||
*/
|
||||
private String modelImage;
|
||||
/**
|
||||
* 禁用 0、正常 1、禁用
|
||||
*/
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.ai.convert.ChatModalConvert;
|
||||
import cn.iocoder.yudao.module.ai.dal.dataobject.AiChatModalDO;
|
||||
import cn.iocoder.yudao.module.ai.enums.AiChatModalDisableEnum;
|
||||
import cn.iocoder.yudao.module.ai.mapper.AiChatModalMapper;
|
||||
import cn.iocoder.yudao.module.ai.service.AiChatModalService;
|
||||
import cn.iocoder.yudao.module.ai.vo.AiChatModalAddReq;
|
||||
@ -48,6 +49,11 @@ public class AiChatModalServiceImpl implements AiChatModalService {
|
||||
|
||||
@Override
|
||||
public void add(AiChatModalAddReq req) {
|
||||
|
||||
// 转换 do
|
||||
AiChatModalDO insertChatModalDO = ChatModalConvert.INSTANCE.convertAiChatModalDO(req);
|
||||
//
|
||||
insertChatModalDO.setDisable(AiChatModalDisableEnum.NO.getValue());
|
||||
// 保存数据库
|
||||
aiChatModalMapper.insert(insertChatModalDO);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.ai.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ -13,4 +16,21 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AiChatModalAddReq {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "模型名字")
|
||||
@Size(max = 60, message = "模型名字最大60")
|
||||
private String modelName;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "模型类型(qianwen、yiyan、xinghuo、openai)")
|
||||
@Size(max = 32, message = "模型类型最大32")
|
||||
private String modelType;
|
||||
|
||||
@Schema(description = "模型照片")
|
||||
private String modalImage;
|
||||
|
||||
@Schema(description = "模型配置JSON")
|
||||
private String modelConfig;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user