Fix/segment create with api (#7928)

This commit is contained in:
Jyong 2024-09-03 18:14:47 +08:00 committed by GitHub
parent 01581dd35f
commit 1a5116cba0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: