From eb134a034d489b22378193e8edb37bf20b8ae4bf Mon Sep 17 00:00:00 2001 From: zhuangtianxiang <2913129173@qq.com> Date: Thu, 15 May 2025 20:48:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(dify):=20=E4=BC=98=E5=8C=96=20Dify=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86-=20=E5=9C=A8=20messages=20=E6=96=B9=E6=B3=95=E4=B8=AD?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20ExceptionUtil.difyException()=20=E5=8C=85?= =?UTF-8?q?=E8=A3=85=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=20-=20=E5=9C=A8?= =?UTF-8?q?=20deleteConversation=20=E6=96=B9=E6=B3=95=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7=EF=BC=8C=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E6=9B=B4=E5=85=B7=E4=BD=93=E7=9A=84=20RuntimeExceptio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dify/modules/dify/controller/V1ChatController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zsc/edu/dify/modules/dify/controller/V1ChatController.java b/src/main/java/com/zsc/edu/dify/modules/dify/controller/V1ChatController.java index 7892005..c33ce6f 100644 --- a/src/main/java/com/zsc/edu/dify/modules/dify/controller/V1ChatController.java +++ b/src/main/java/com/zsc/edu/dify/modules/dify/controller/V1ChatController.java @@ -106,7 +106,7 @@ public class V1ChatController { ) { String apiKey = appEntityService.getApikey(appid); request.setApiKey(apiKey); - return difyChat.messages(request); + return ExceptionUtil.difyException(()->difyChat.messages(request)); } /** @@ -133,7 +133,11 @@ public class V1ChatController { public void deleteConversation(@RequestParam String conversationId, @RequestParam String appId) { String apiKey = appEntityService.getApikey(appId); String userId = SecurityUtil.getUserInfo().id.toString(); - difyChat.deleteConversation(conversationId, apiKey,userId); + try{ + difyChat.deleteConversation(conversationId, apiKey,userId); + }catch (RuntimeException e){ + throw new RuntimeException("删除会话失败"+e.getMessage()); + } } /**