Spaces:
Running
Running
add
Browse files
infrastructure/database.py
CHANGED
|
@@ -83,10 +83,7 @@ def _init_chroma_client():
|
|
| 83 |
|
| 84 |
base_candidates: list[Optional[str]] = [
|
| 85 |
CHROMA_PATH,
|
| 86 |
-
"/data/chroma_db"
|
| 87 |
-
"/home/user/chroma_db",
|
| 88 |
-
"/tmp/chroma_db",
|
| 89 |
-
]
|
| 90 |
if force_tmp:
|
| 91 |
base_candidates = ["/tmp/chroma_db"] # override order if forced
|
| 92 |
|
|
@@ -96,7 +93,6 @@ def _init_chroma_client():
|
|
| 96 |
if c and c not in seen:
|
| 97 |
candidates.append(c)
|
| 98 |
seen.add(c)
|
| 99 |
-
candidates.append(None) # final in-memory fallback
|
| 100 |
|
| 101 |
tried: list[tuple[Optional[str], str]] = []
|
| 102 |
|
|
@@ -104,7 +100,7 @@ def _init_chroma_client():
|
|
| 104 |
try:
|
| 105 |
os.makedirs(path, exist_ok=True)
|
| 106 |
test_file = os.path.join(path, ".write_test")
|
| 107 |
-
with open(test_file, "
|
| 108 |
tf.write("ok")
|
| 109 |
os.remove(test_file)
|
| 110 |
return True
|
|
|
|
| 83 |
|
| 84 |
base_candidates: list[Optional[str]] = [
|
| 85 |
CHROMA_PATH,
|
| 86 |
+
"/data/chroma_db"]
|
|
|
|
|
|
|
|
|
|
| 87 |
if force_tmp:
|
| 88 |
base_candidates = ["/tmp/chroma_db"] # override order if forced
|
| 89 |
|
|
|
|
| 93 |
if c and c not in seen:
|
| 94 |
candidates.append(c)
|
| 95 |
seen.add(c)
|
|
|
|
| 96 |
|
| 97 |
tried: list[tuple[Optional[str], str]] = []
|
| 98 |
|
|
|
|
| 100 |
try:
|
| 101 |
os.makedirs(path, exist_ok=True)
|
| 102 |
test_file = os.path.join(path, ".write_test")
|
| 103 |
+
with open(test_file, "a", encoding="utf-8") as tf:
|
| 104 |
tf.write("ok")
|
| 105 |
os.remove(test_file)
|
| 106 |
return True
|