mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
fix: Handle non-existent directories in memory reset
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -149,10 +149,13 @@ class RAGStorage(BaseRAGStorage):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def reset(self) -> None:
|
def reset(self) -> None:
|
||||||
|
"""Reset the storage by removing the database files and reinitializing."""
|
||||||
try:
|
try:
|
||||||
if self.app:
|
if self.app:
|
||||||
self.app.reset()
|
self.app.reset()
|
||||||
shutil.rmtree(f"{db_storage_path()}/{self.type}")
|
storage_path = os.path.join(db_storage_path(), self.type)
|
||||||
|
if os.path.exists(storage_path):
|
||||||
|
shutil.rmtree(storage_path)
|
||||||
self.app = None
|
self.app = None
|
||||||
self.collection = None
|
self.collection = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user