|
@@ -150,14 +150,17 @@ public class AlgorithmModelTrackServiceImpl extends BaseServiceImpl<AlgorithmMod
|
|
|
@Override
|
|
|
public CommonResult<String> insert(AlgorithmModelTrackBo algorithmModelTrackBo) {
|
|
|
AlgorithmConfigTrackVo algorithmConfigTrackVo = algorithmConfigTrackService.selectById(algorithmModelTrackBo.getAlgorithmId());
|
|
|
- if (algorithmConfigTrackVo.getType().equals(AlgorithmType.REASONING) && ObjectUtil.isEmpty(algorithmModelTrackBo.getModelInputOssId())) {
|
|
|
- return CommonResult.fail("预测算法必须上传模型文件");
|
|
|
+ if (algorithmConfigTrackVo.getType().equals(AlgorithmType.REASONING) &&
|
|
|
+ ObjectUtil.isEmpty(algorithmModelTrackBo.getModelInputOssId()) &&
|
|
|
+ ObjectUtil.isEmpty(algorithmModelTrackBo.getModelPath())
|
|
|
+ ) {
|
|
|
+ return CommonResult.fail("预测算法必须上传模型文件或指定模型路径!");
|
|
|
}
|
|
|
|
|
|
AlgorithmModelTrack algorithmModelTrack = MapstructUtils.convert(algorithmModelTrackBo, AlgorithmModelTrack.class);
|
|
|
|
|
|
String resourcePath = null;
|
|
|
- if (algorithmModelTrackBo.getModelInputOssId() != null) {
|
|
|
+ if (ObjectUtil.isNotEmpty(algorithmModelTrackBo.getModelInputOssId())) {
|
|
|
SysOssVo inputOssEntity = ossService.getById(algorithmModelTrackBo.getModelInputOssId());
|
|
|
|
|
|
String filePath = inputOssEntity.getFileName();
|
|
@@ -177,11 +180,13 @@ public class AlgorithmModelTrackServiceImpl extends BaseServiceImpl<AlgorithmMod
|
|
|
} else {
|
|
|
return CommonResult.fail("模型格式不正确,请上传.zip或.pt文件");
|
|
|
}
|
|
|
- } else {
|
|
|
- // String localPath = TaaisConfig.getUploadPath();
|
|
|
- // String path = DateUtils.datePath() + "/" + IdUtil.fastSimpleUUID();
|
|
|
- // resourcePath = localPath + "/" + path + ".pt";
|
|
|
- // 本来这里是默认整一个虚拟模型地址,后面发现不合适便去掉了
|
|
|
+ } // 这是使用ossid上传
|
|
|
+ else if(ObjectUtil.isNotEmpty(algorithmModelTrackBo.getModelPath())) { // 这是使用路径上传
|
|
|
+ File modelFile = new File(algorithmModelTrackBo.getModelPath());
|
|
|
+ if (!modelFile.exists() || !modelFile.isFile()) {
|
|
|
+ return CommonResult.fail("请指定正确的模型路径!");
|
|
|
+ }
|
|
|
+ algorithmModelTrack.setModelAddress(algorithmModelTrackBo.getModelPath());
|
|
|
}
|
|
|
|
|
|
if (AlgorithmType.REASONING.equals(algorithmConfigTrackVo.getType()) || AlgorithmType.TEST.equals(algorithmConfigTrackVo.getType())) {
|