From 08b541cc75abf1470ee5b41aa5b5c588e9c2fb51 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 23:28:47 +0000 Subject: [PATCH] fix: Clean up both ChromaDB files and temp directories in reset Co-Authored-By: Joe Moura --- src/crewai/memory/storage/rag_storage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/crewai/memory/storage/rag_storage.py b/src/crewai/memory/storage/rag_storage.py index 88936bd9e..a64c4dba1 100644 --- a/src/crewai/memory/storage/rag_storage.py +++ b/src/crewai/memory/storage/rag_storage.py @@ -153,9 +153,13 @@ class RAGStorage(BaseRAGStorage): try: if self.app: self.app.reset() + # Clean up ChromaDB files storage_path = os.path.join(db_storage_path(), self.type) if os.path.exists(storage_path): shutil.rmtree(storage_path) + # Clean up temporary directory + if os.path.exists(self.path): + shutil.rmtree(self.path) self.app = None self.collection = None except Exception as e: