From 472ad1589bb5580d0bf8eaea5ccd1efe6ef863cd Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 30 Aug 2024 15:35:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E6=9F=A5=E8=AF=BB=E5=8F=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChatMessageServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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())); } //循环查找对应的模型数据