fix:sync status idempotent

when RUNNING AND FINISHED cannot sync
This commit is contained in:
aries_ckt 2023-06-29 17:46:53 +08:00
parent 7ad629eb3d
commit f29a0a2472

View File

@ -115,6 +115,8 @@ class KnowledgeService:
space=space_name, space=space_name,
) )
doc = knowledge_document_dao.get_knowledge_documents(query)[0] doc = knowledge_document_dao.get_knowledge_documents(query)[0]
if doc.status == SyncStatus.RUNNING.name or doc.status == SyncStatus.FINISHED.name:
raise Exception(f"RUNNING AND FINISHED doc:{doc.name} can not sync")
client = KnowledgeEmbedding( client = KnowledgeEmbedding(
knowledge_source=doc.content, knowledge_source=doc.content,
knowledge_type=doc.doc_type.upper(), knowledge_type=doc.doc_type.upper(),