Переглянути джерело

Fix/segment create with api (#7928)

Jyong 7 місяців тому
батько
коміт
1a5116cba0
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      api/controllers/service_api/dataset/segment.py

+ 4 - 0
api/controllers/service_api/dataset/segment.py

@@ -36,6 +36,10 @@ class SegmentApi(DatasetApiResource):
         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: