Spaces:
Running
Running
Upload folder using huggingface_hub (part 2)
Browse files
src/config.py
CHANGED
|
@@ -596,11 +596,20 @@ class Config:
|
|
| 596 |
self.data_db = os.getenv("DATA_DB", "mongo")
|
| 597 |
self.graph_db = os.getenv("GRAPH_DB", "neo4j")
|
| 598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
self.redis = RedisConfig()
|
| 600 |
-
self.neo4j = Neo4jConfig()
|
| 601 |
-
self.postgresql = PostgreSQLConfig()
|
| 602 |
-
self.milvus = MilvusConfig()
|
| 603 |
-
self.mongo = MongoConfig()
|
| 604 |
self.celery = CeleryConfig()
|
| 605 |
self.spacy = SpacyConfig()
|
| 606 |
|
|
|
|
| 596 |
self.data_db = os.getenv("DATA_DB", "mongo")
|
| 597 |
self.graph_db = os.getenv("GRAPH_DB", "neo4j")
|
| 598 |
|
| 599 |
+
need_mongo = self.data_db.strip().lower() == "mongo"
|
| 600 |
+
need_milvus = self.vector_db.strip().lower() == "milvus"
|
| 601 |
+
need_neo4j = self.graph_db.strip().lower() == "neo4j"
|
| 602 |
+
need_postgres = (
|
| 603 |
+
self.data_db.strip().lower() == "postgresql"
|
| 604 |
+
or self.vector_db.strip().lower() == "postgresql"
|
| 605 |
+
or self.graph_db.strip().lower() == "networkx"
|
| 606 |
+
)
|
| 607 |
+
|
| 608 |
self.redis = RedisConfig()
|
| 609 |
+
self.neo4j = Neo4jConfig() if need_neo4j else None
|
| 610 |
+
self.postgresql = PostgreSQLConfig() if need_postgres else None
|
| 611 |
+
self.milvus = MilvusConfig() if need_milvus else None
|
| 612 |
+
self.mongo = MongoConfig() if need_mongo else None
|
| 613 |
self.celery = CeleryConfig()
|
| 614 |
self.spacy = SpacyConfig()
|
| 615 |
|
src/services/api/middlewares/auth.py
CHANGED
|
@@ -39,7 +39,7 @@ class BrainPATMiddleware(BaseHTTPMiddleware):
|
|
| 39 |
if is_console_path(request.url.path):
|
| 40 |
return await call_next(request)
|
| 41 |
|
| 42 |
-
if any(request.url.path.startswith(p) for p in self.excluded_prefixes):
|
| 43 |
return await call_next(request)
|
| 44 |
|
| 45 |
if request.url.path in self.auth_exempt_paths:
|
|
|
|
| 39 |
if is_console_path(request.url.path):
|
| 40 |
return await call_next(request)
|
| 41 |
|
| 42 |
+
if any(request.url.path.startswith(p) for p in self.excluded_prefixes) or "/mcp" in request.url.path:
|
| 43 |
return await call_next(request)
|
| 44 |
|
| 45 |
if request.url.path in self.auth_exempt_paths:
|
src/services/api/middlewares/brains.py
CHANGED
|
@@ -59,7 +59,7 @@ class BrainMiddleware(BaseHTTPMiddleware):
|
|
| 59 |
if is_console_path(request.url.path):
|
| 60 |
return await call_next(request)
|
| 61 |
|
| 62 |
-
if any(request.url.path.startswith(p) for p in self.excluded_prefixes):
|
| 63 |
return await call_next(request)
|
| 64 |
|
| 65 |
if request.url.path in self.brain_exempt_paths:
|
|
|
|
| 59 |
if is_console_path(request.url.path):
|
| 60 |
return await call_next(request)
|
| 61 |
|
| 62 |
+
if any(request.url.path.startswith(p) for p in self.excluded_prefixes) or "/mcp" in request.url.path:
|
| 63 |
return await call_next(request)
|
| 64 |
|
| 65 |
if request.url.path in self.brain_exempt_paths:
|