Spaces:
Runtime error
Runtime error
LOUIS SANNA
commited on
Commit
•
3657397
1
Parent(s):
fe19632
feat(index): fix old data removal
Browse files- .DS_Store +0 -0
- anyqa/build_index.py +8 -3
- chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/data_level0.bin +0 -0
- chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/header.bin +0 -0
- chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/length.bin +0 -0
- chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/link_lists.bin +0 -0
- chroma_db/chroma.sqlite3 +1 -1
.DS_Store
CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
|
|
anyqa/build_index.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
|
3 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
4 |
from langchain.vectorstores import Chroma
|
@@ -49,13 +50,17 @@ def parse_data():
|
|
49 |
|
50 |
|
51 |
def clear_index():
|
52 |
-
|
53 |
-
|
|
|
54 |
try:
|
|
|
55 |
if os.path.isfile(file_path) or os.path.islink(file_path):
|
56 |
os.unlink(file_path)
|
|
|
|
|
57 |
except Exception as e:
|
58 |
-
print("Failed to delete
|
59 |
|
60 |
|
61 |
if __name__ == "__main__":
|
|
|
1 |
import os
|
2 |
+
import shutil
|
3 |
|
4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
5 |
from langchain.vectorstores import Chroma
|
|
|
50 |
|
51 |
|
52 |
def clear_index():
|
53 |
+
directory_path = PERSIST_DIRECTORY
|
54 |
+
for filename in os.listdir(directory_path):
|
55 |
+
file_path = os.path.join(directory_path, filename)
|
56 |
try:
|
57 |
+
print(f"Deleting {file_path}")
|
58 |
if os.path.isfile(file_path) or os.path.islink(file_path):
|
59 |
os.unlink(file_path)
|
60 |
+
elif os.path.isdir(file_path):
|
61 |
+
shutil.rmtree(file_path)
|
62 |
except Exception as e:
|
63 |
+
print(f"Failed to delete {file_path}. Reason: {e}")
|
64 |
|
65 |
|
66 |
if __name__ == "__main__":
|
chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/data_level0.bin
RENAMED
File without changes
|
chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/header.bin
RENAMED
File without changes
|
chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/length.bin
RENAMED
File without changes
|
chroma_db/{01ac9c34-80c7-488f-b1ef-a9d1a5ebc563 → 5e9a66b6-12a7-48c3-9eb0-2277bce39a9f}/link_lists.bin
RENAMED
File without changes
|
chroma_db/chroma.sqlite3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 4067328
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1a2468aca51f2daeb2d17211c52294d76e19dd9dde6dcf846fc30a6054d75e75
|
3 |
size 4067328
|