enh: sync directory

This commit is contained in:
Timothy J. Baek
2024-10-04 18:44:57 -07:00
parent e3889522d6
commit a909aa1c20
5 changed files with 110 additions and 11 deletions

View File

@@ -313,6 +313,25 @@ def remove_file_from_knowledge_by_id(
)
############################
# ResetKnowledgeById
############################
@router.post("/{id}/reset", response_model=Optional[KnowledgeResponse])
async def reset_knowledge_by_id(id: str, user=Depends(get_admin_user)):
try:
VECTOR_DB_CLIENT.delete_collection(collection_name=id)
except Exception as e:
log.debug(e)
pass
knowledge = Knowledges.update_knowledge_by_id(
id=id, form_data=KnowledgeUpdateForm(data={"file_ids": []})
)
return knowledge
############################
# DeleteKnowledgeById
############################