Spaces:
Running
Running
add chmod
Browse files- app.py +1 -1
- infrastructure/database.py +3 -3
- infrastructure/embeddings.py +1 -1
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def create_app():
|
|
| 29 |
|
| 30 |
app.register_blueprint(web_bp)
|
| 31 |
app.register_blueprint(api_bp)
|
| 32 |
-
|
| 33 |
|
| 34 |
with app.app_context():
|
| 35 |
logger = get_logger()
|
|
|
|
| 29 |
|
| 30 |
app.register_blueprint(web_bp)
|
| 31 |
app.register_blueprint(api_bp)
|
| 32 |
+
|
| 33 |
|
| 34 |
with app.app_context():
|
| 35 |
logger = get_logger()
|
infrastructure/database.py
CHANGED
|
@@ -99,7 +99,7 @@ def _init_chroma_client():
|
|
| 99 |
for cand in candidates:
|
| 100 |
if cand is None:
|
| 101 |
_logger.error("ChromaDB falling back to in-memory client (no persistence).")
|
| 102 |
-
return chromadb.
|
| 103 |
|
| 104 |
abs_path = os.path.abspath(cand)
|
| 105 |
_logger.error(f"Attempting Chroma PersistentClient at {abs_path}")
|
|
@@ -126,7 +126,7 @@ def _init_chroma_client():
|
|
| 126 |
|
| 127 |
_logger.info(f"Initializing Chroma PersistentClient at {abs_path}")
|
| 128 |
try:
|
| 129 |
-
client = chromadb.PersistentClient(path=
|
| 130 |
except Exception as e: # immediate failure
|
| 131 |
tried.append((abs_path, f"create failed: {e}"))
|
| 132 |
_logger.error(f"Chroma path {abs_path} not writable for DB operations, trying next candidate...")
|
|
@@ -179,7 +179,7 @@ def _init_chroma_client():
|
|
| 179 |
continue
|
| 180 |
|
| 181 |
_logger.error("Failed to initialize persistent Chroma client; attempts=%s. Using in-memory fallback.", tried)
|
| 182 |
-
return chromadb.
|
| 183 |
|
| 184 |
_client = _init_chroma_client()
|
| 185 |
|
|
|
|
| 99 |
for cand in candidates:
|
| 100 |
if cand is None:
|
| 101 |
_logger.error("ChromaDB falling back to in-memory client (no persistence).")
|
| 102 |
+
return chromadb.PersistentClient(path=os.environ["PERSIST_DIRECTORY"]) # type: ignore
|
| 103 |
|
| 104 |
abs_path = os.path.abspath(cand)
|
| 105 |
_logger.error(f"Attempting Chroma PersistentClient at {abs_path}")
|
|
|
|
| 126 |
|
| 127 |
_logger.info(f"Initializing Chroma PersistentClient at {abs_path}")
|
| 128 |
try:
|
| 129 |
+
client = chromadb.PersistentClient(path=os.environ["PERSIST_DIRECTORY"])
|
| 130 |
except Exception as e: # immediate failure
|
| 131 |
tried.append((abs_path, f"create failed: {e}"))
|
| 132 |
_logger.error(f"Chroma path {abs_path} not writable for DB operations, trying next candidate...")
|
|
|
|
| 179 |
continue
|
| 180 |
|
| 181 |
_logger.error("Failed to initialize persistent Chroma client; attempts=%s. Using in-memory fallback.", tried)
|
| 182 |
+
return chromadb.PersistentClient(path=os.environ["PERSIST_DIRECTORY"]) # type: ignore
|
| 183 |
|
| 184 |
_client = _init_chroma_client()
|
| 185 |
|
infrastructure/embeddings.py
CHANGED
|
@@ -57,7 +57,7 @@ def get_chroma_collection():
|
|
| 57 |
model_name=DEFAULT_MODEL
|
| 58 |
)
|
| 59 |
|
| 60 |
-
client = chromadb.PersistentClient(path=
|
| 61 |
|
| 62 |
# Pass the embedding function to the get_or_create_collection method
|
| 63 |
collection = client.get_or_create_collection(name=CHROMA_COLLECTION)
|
|
|
|
| 57 |
model_name=DEFAULT_MODEL
|
| 58 |
)
|
| 59 |
|
| 60 |
+
client = chromadb.PersistentClient(path=os.environ["PERSIST_DIRECTORY"])
|
| 61 |
|
| 62 |
# Pass the embedding function to the get_or_create_collection method
|
| 63 |
collection = client.get_or_create_collection(name=CHROMA_COLLECTION)
|