Update py/db_storage.py
Browse files- py/db_storage.py +6 -2
py/db_storage.py
CHANGED
|
@@ -164,9 +164,13 @@ class DBStorage:
|
|
| 164 |
check_and_delete(FAISS_DB_PATH)
|
| 165 |
vector_store.save_local(FAISS_DB_PATH)
|
| 166 |
|
| 167 |
-
def check_and_delete(PATH):
|
| 168 |
if os.path.isdir(PATH):
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
print(f'Deleted {PATH}')
|
| 171 |
|
| 172 |
|
|
|
|
| 164 |
check_and_delete(FAISS_DB_PATH)
|
| 165 |
vector_store.save_local(FAISS_DB_PATH)
|
| 166 |
|
| 167 |
+
def check_and_delete(PATH, hugg=False):
|
| 168 |
if os.path.isdir(PATH):
|
| 169 |
+
if hugg:
|
| 170 |
+
shutil.rmtree(PATH)
|
| 171 |
+
else:
|
| 172 |
+
shutil.rmtree(PATH, onexc=lambda func, path, exc: os.chmod(path, 0o777))
|
| 173 |
+
|
| 174 |
print(f'Deleted {PATH}')
|
| 175 |
|
| 176 |
|