RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix bug about removing KB. (#839)
KevinHuSh6683179d6aa4
diff --git a/api/apps/kb_app.py b/api/apps/kb_app.pyindex f62d851603..26b78dd420 100644--- a/api/apps/kb_app.py+++ b/api/apps/kb_app.py@@ -19,12 +19,14 @@ from flask_login import login_required, current_userfrom api.db.services import duplicate_namefrom api.db.services.document_service import DocumentService+from api.db.services.file2document_service import File2DocumentService+from api.db.services.file_service import FileServicefrom api.db.services.user_service import TenantService, UserTenantServicefrom api.utils.api_utils import server_error_response, get_data_error_result, validate_requestfrom api.utils import get_uuid, get_format_time-from api.db import StatusEnum, UserTenantRole+from api.db import StatusEnum, UserTenantRole, FileSourcefrom api.db.services.knowledgebase_service import KnowledgebaseService-from api.db.db_models import Knowledgebase+from api.db.db_models import Knowledgebase, Filefrom api.settings import stat_logger, RetCodefrom api.utils.api_utils import get_json_resultfrom rag.nlp import search@@ -139,9 +141,11 @@ def rm():if not DocumentService.remove_document(doc, kbs[0].tenant_id):return get_data_error_result(retmsg="Database error (Document removal)!")+ f2d = File2DocumentService.get_by_document_id(doc.id)+ FileService.filter_delete([File.source_type == FileSource.KNOWLEDGEBASE, File.id == f2d[0].file_id])+ File2DocumentService.delete_by_document_id(doc.id)- if not KnowledgebaseService.update_by_id(- req["kb_id"], {"status": StatusEnum.INVALID.value}):+ if not KnowledgebaseService.delete_by_id(req["kb_id"]):return get_data_error_result(retmsg="Database error (Knowledgebase removal)!")return get_json_result(data=True)