数据集导入 状态修改判断

This commit is contained in:
limin 2025-01-06 16:38:26 +08:00
parent 0fd15cb3ad
commit 733e206f7c
2 changed files with 16 additions and 1 deletions

View File

@ -92,6 +92,7 @@ public interface ErrorCodeConstants {
ErrorCode PROMPT_TEMPLATES_TAGS_BACKUP_NOT_EXISTS = new ErrorCode(10037, "模板信息不存在");
ErrorCode DATA_PROCESS_TASK_NAME_NOT_EXISTS = new ErrorCode(10038, "数据处理任务名称已存在");
ErrorCode FINE_TUNING_TASK_NAME_NOT_EXISTS = new ErrorCode(10039, "模型调优任务名称已存在");
}

View File

@ -25,7 +25,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.FINE_TUNING_TASK_NOT_EXISTS;
import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.*;
/**
@ -49,6 +49,7 @@ public class FineTuningTaskServiceImpl implements FineTuningTaskService {
@Override
public Long createFineTuningTask(FineTuningTaskSaveReqVO createReqVO) {
// 插入
validateFineTuningNameTaskExists(createReqVO);
FineTuningTaskDO fineTuningTask = BeanUtils.toBean(createReqVO, FineTuningTaskDO.class);
fineTuningTaskMapper.insert(fineTuningTask);
//todo 调用模型服务创建调优任务
@ -61,6 +62,7 @@ public class FineTuningTaskServiceImpl implements FineTuningTaskService {
public void updateFineTuningTask(FineTuningTaskSaveReqVO updateReqVO) {
// 校验存在
validateFineTuningTaskExists(updateReqVO.getId());
validateFineTuningNameTaskExists(updateReqVO);
// 更新
FineTuningTaskDO updateObj = BeanUtils.toBean(updateReqVO, FineTuningTaskDO.class);
fineTuningTaskMapper.updateById(updateObj);
@ -83,6 +85,18 @@ public class FineTuningTaskServiceImpl implements FineTuningTaskService {
throw exception(FINE_TUNING_TASK_NOT_EXISTS);
}
}
private void validateFineTuningNameTaskExists(FineTuningTaskSaveReqVO reqVO) {
LambdaQueryWrapper<FineTuningTaskDO> wrapper = new LambdaQueryWrapper<FineTuningTaskDO>()
.eq(FineTuningTaskDO::getTaskName, reqVO.getTaskName());
if (reqVO.getId() != null){
wrapper.ne(FineTuningTaskDO::getId, reqVO.getId());
}
List<FineTuningTaskDO> dineTuningTaskDos = fineTuningTaskMapper.selectList(wrapper);
if (CollectionUtils.isNotEmpty(dineTuningTaskDos)){
throw exception(FINE_TUNING_TASK_NAME_NOT_EXISTS);
}
}
@Override
public FineTuningTaskRespVO getFineTuningTask(Long id) {