From 1a5116cba084c17ea67252b7d71dec321909a721 Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:14:47 +0800 Subject: [PATCH] Fix/segment create with api (#7928) --- api/controllers/service_api/dataset/segment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/controllers/service_api/dataset/segment.py b/api/controllers/service_api/dataset/segment.py index 5e10f3b48c3f9f..570af339bd9e6f 100644 --- a/api/controllers/service_api/dataset/segment.py +++ b/api/controllers/service_api/dataset/segment.py @@ -36,6 +36,10 @@ def post(self, tenant_id, dataset_id, document_id): document = DocumentService.get_document(dataset.id, document_id) if not document: raise NotFound("Document not found.") + if document.indexing_status != "completed": + raise NotFound("Document is already completed.") + if not document.enabled: + raise NotFound("Document is disabled.") # check embedding model setting if dataset.indexing_technique == "high_quality": try: