From a709abfd8ffec1524cefff30c3581f4425695433 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期四, 05 十二月 2024 17:05:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
index da91e2d..e8a9142 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
@@ -16,12 +16,16 @@
 import com.iailab.module.model.mdk.sample.SampleConstructor;
 import com.iailab.module.model.mdk.sample.dto.SampleData;
 import com.iailab.module.model.mdk.vo.PredictResultVO;
+import com.iailab.module.model.mpk.common.MdkConstant;
 import com.iailab.module.model.mpk.common.utils.DllUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author PanZhibao
@@ -65,6 +69,11 @@
             }
             IAILModel newModelBean = composeNewModelBean(predictModel);
             HashMap<String, Object> settings = getPredictSettingsByModelId(modelId);
+            // 校验setting必须有pyFile,否则可能导致程序崩溃
+            if (!settings.containsKey(MdkConstant.PY_FILE_KEY)) {
+                throw new RuntimeException("模型设置参数缺少必要信息【" + MdkConstant.PY_FILE_KEY +  "】,请重新上传模型!");
+            }
+
             if (settings == null) {
                 log.error("模型setting不存在,modelId=" + modelId);
                 return null;

--
Gitblit v1.9.3