From 1ed9351fba924b1b772b088942ab638ec7fbbbac Mon Sep 17 00:00:00 2001 From: sunxiqing <2240398334@qq.com> Date: Mon, 10 Mar 2025 09:48:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(llm):=20=E4=BF=AE=E5=A4=8D=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9F=A5=E8=AF=86=E5=BA=93=E6=96=87=E6=A1=A3=E6=97=B6?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在删除知识库文档的代码中添加了异常捕获处理 - 当删除操作失败时,记录错误日志并抛出自定义异常 - 优化了代码的健壮性,提高了系统稳定性 --- .../module/llm/service/async/AsyncKnowledgeBase.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/async/AsyncKnowledgeBase.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/async/AsyncKnowledgeBase.java index 9dceee18d..2823f33a9 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/async/AsyncKnowledgeBase.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/async/AsyncKnowledgeBase.java @@ -45,8 +45,13 @@ public class AsyncKnowledgeBase { // 如果提供了 ids,则删除现有的知识库文档 if (!CollectionUtils.isAnyEmpty(ids)) { log.info("正在删除现有的知识库文档,ids: {}", ids); - String mes = ragHttpService.ragDocumentsDel(llmBackendProperties.getRagDocumentsDel(), ids); - log.info("删除知识库信息: {}", mes); + try { + String mes = ragHttpService.ragDocumentsDel(llmBackendProperties.getRagDocumentsDel(), ids); + log.info("删除知识库信息: {}", mes); + } catch (Exception e) { + log.error("删除知识库信息失败: {}", e.getMessage()); + throw exception(new ErrorCode(10047, "删除知识库信息失败!")); + } } else { log.info("未提供 ids,跳过删除操作。"); }