diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index 2b77d6c..d11477a 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -306,14 +306,19 @@ public class ChatMessageServiceImpl implements ChatMessageService { List chatModels = new ArrayList<>(); ChatModelDto chatModel = null; + //验证获取模型数据 异常问题 + File file = null; try { - File file = new File(ClassLoader.getSystemResource("Json/ChatModel.json").getPath()); //相对路径获取文件信息 + file = new File(ClassLoader.getSystemResource("Json/ChatModel.json").getPath()); //相对路径获取文件信息 //File file = new File("src/main/resources/Json/ChatModel.json"); //绝对路径获取文件信息 - + } catch (Exception e) { + throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "读取文件" + Arrays.toString(e.getStackTrace())); + } + try { //chatModel = readerMethod(file); chatModels = readerMethod(file); } catch (Exception e) { - throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), e.getMessage()); + throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "读取文件并转换实体类" + Arrays.toString(e.getStackTrace())); } //循环查找对应的模型数据