模型服务管理 增加返回值
This commit is contained in:
parent
6191173b11
commit
77a08f2d7f
@ -93,6 +93,13 @@ public class FineTuningTaskController {
|
||||
PageResult<FineTuningTaskRespVO> pageResult = fineTuningTaskService.getFineTuningTaskPage1(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获得模型调优 —— 微调任务列表")
|
||||
@PreAuthorize("@ss.hasPermission('llm:fine-tuning-task:query')")
|
||||
public CommonResult<List<FineTuningTaskRespVO>> getFineTuningTaskList() {
|
||||
List<FineTuningTaskRespVO> list = fineTuningTaskService.selectAll();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出模型调优 —— 微调任务 Excel")
|
||||
|
@ -100,8 +100,8 @@ public class ModelServiceController {
|
||||
@Operation(summary = "获得模型服务分页")
|
||||
@PreAuthorize("@ss.hasPermission('llm:model-service:query')")
|
||||
public CommonResult<PageResult<ModelServiceRespVO>> getModelServicePage(@Valid ModelServicePageReqVO pageReqVO) {
|
||||
PageResult<ModelServiceDO> pageResult = modelServiceService.getModelServicePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ModelServiceRespVO.class));
|
||||
PageResult<ModelServiceRespVO> pageResult = modelServiceService.getModelServicePage1(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
|
@ -49,4 +49,11 @@ public class ModelServiceRespVO {
|
||||
@DictFormat("llm_model_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "微调任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String fineTuningTaskName;
|
||||
|
||||
}
|
||||
|
@ -71,4 +71,7 @@ public interface FineTuningTaskService {
|
||||
* @param id
|
||||
*/
|
||||
void startFineTuningTask(Long id);
|
||||
|
||||
List<FineTuningTaskRespVO> selectAll();
|
||||
|
||||
}
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -142,6 +143,12 @@ public class FineTuningTaskServiceImpl implements FineTuningTaskService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FineTuningTaskRespVO> selectAll() {
|
||||
List<FineTuningTaskDO> fineTuningTaskDOS = fineTuningTaskMapper.selectList();
|
||||
return BeanUtils.toBean(fineTuningTaskDOS, FineTuningTaskRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopFineTuningTask(Long id) {
|
||||
fineTuningTaskMapper.stopStartTask(id,1);
|
||||
|
@ -61,4 +61,6 @@ public interface ModelServiceService {
|
||||
void active(ModelServiceSaveReqVO updateReqVO);
|
||||
|
||||
void unactive(ModelServiceSaveReqVO updateReqVO);
|
||||
|
||||
PageResult<ModelServiceRespVO> getModelServicePage1(ModelServicePageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.llm.service.modelservice;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.finetuningtask.FineTuningTaskDO;
|
||||
import cn.iocoder.yudao.module.llm.dal.mysql.finetuningtask.FineTuningTaskMapper;
|
||||
import cn.iocoder.yudao.module.llm.service.async.AsyncModelServiceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -7,6 +10,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.modelservice.vo.*;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.modelservice.ModelServiceDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -32,6 +37,8 @@ public class ModelServiceServiceImpl implements ModelServiceService {
|
||||
|
||||
@Resource
|
||||
private AsyncModelServiceService asyncModelServiceService;
|
||||
@Resource
|
||||
private FineTuningTaskMapper fineTuningTaskMapper;
|
||||
|
||||
@Override
|
||||
public Long createModelService(ModelServiceSaveReqVO createReqVO) {
|
||||
@ -107,4 +114,24 @@ public class ModelServiceServiceImpl implements ModelServiceService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ModelServiceRespVO> getModelServicePage1(ModelServicePageReqVO pageReqVO) {
|
||||
PageResult<ModelServiceDO> pageResult = modelServiceMapper.selectPage(pageReqVO);
|
||||
PageResult<ModelServiceRespVO> respVo = BeanUtils.toBean(pageResult, ModelServiceRespVO.class);
|
||||
if (!CollectionUtils.isAnyEmpty(pageResult.getList())){
|
||||
List<Long> ids = pageResult.getList().stream()
|
||||
.map(ModelServiceDO::getFineTuningTask)
|
||||
.collect(Collectors.toList());
|
||||
List<FineTuningTaskDO> fineTuningTaskDOS = fineTuningTaskMapper.selectBatchIds(ids);
|
||||
Map<Long, FineTuningTaskDO> fineTuningTaskMap = CollectionUtils.convertMap(fineTuningTaskDOS, FineTuningTaskDO::getId);
|
||||
respVo.getList().forEach(item->{
|
||||
FineTuningTaskDO fineTuningTaskDO = fineTuningTaskMap.get(item.getFineTuningTask());
|
||||
if(fineTuningTaskDO != null){
|
||||
item.setFineTuningTaskName(fineTuningTaskDO.getTaskName());
|
||||
}
|
||||
});
|
||||
}
|
||||
return respVo;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user