From 77979ff640fcfb8d3d20a64af1fd5b3bfbd60fb8 Mon Sep 17 00:00:00 2001 From: luyie Date: Thu, 26 Sep 2024 10:49:01 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=9F=A5=E8=AF=86=E5=BA=93=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E5=90=91=E9=87=8F?= =?UTF-8?q?=E5=BA=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/service/KnowledgeFileInfoService.java | 1 + .../service/impl/KnowledgeFileInfoServiceImpl.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java index 52d11df..db445bb 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java @@ -17,6 +17,7 @@ import java.util.List; */ public interface KnowledgeFileInfoService extends IService { String SEGMENT_URL = "/kn/doc_segment"; + String VECTOR_DATABASE_NAME = "knowledge_data"; Boolean store(IdRequest req); diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java index 8f9f29c..5e1252b 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.gglm.bigmodel.database.service.WeaviateService; import com.hnac.gglm.bigmodel.maintenance.constants.StoreStatus; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileInfo; @@ -45,6 +46,7 @@ public class KnowledgeFileInfoServiceImpl extends ServiceImpl idsList) { Boolean result = removeByIds(idsList); if (result) { - fileFragmentService.remove(Wrappers.lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList)); + try { + fileFragmentService.remove(Wrappers.lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList)); + for (Long id : idsList) { + Map condition = new HashMap<>(); + condition.put("doc_id", id.toString()); + weaviateService.deleteCondition(VECTOR_DATABASE_NAME, condition); + } + } catch (Exception e) { + log.error("删除知识库文件文件出错", e); + } } return result; }