Spaces:
Running
Running
| """ | |
| Configuration for the Agent Monitoring System | |
| """ | |
| import os | |
| from pathlib import Path | |
| # Server config | |
| PORT = 5280 | |
| HOST = "127.0.0.1" | |
| DEFAULT_NAMESPACE = "default" | |
| SERVER_VERSION = "1.2.0" | |
| MAX_PORT_ATTEMPTS = 50 | |
| LOG_LEVEL = "INFO" | |
| # Get the project root directory (backend/server_config.py -> backend/ -> project_root/) | |
| PROJECT_ROOT = Path(__file__).resolve().parent.parent | |
| # Paths (using absolute paths relative to project root) | |
| PROCESSING_STATUS_FILE = str(PROJECT_ROOT / "logs" / "processing_status.json") | |
| TEST_RESULTS_FILE = str(PROJECT_ROOT / "datasets" / "test_results" / "test_results.json") | |
| # Features availability flags | |
| KNOWLEDGE_GRAPH_TESTER_AVAILABLE = True | |
| PROMPT_RECONSTRUCTOR_AVAILABLE = True | |
| PROMPT_TESTER_AVAILABLE = True | |
| # File paths | |
| DEFAULT_KNOWLEDGE_GRAPH = os.getenv("DEFAULT_KNOWLEDGE_GRAPH", str(PROJECT_ROOT / "datasets" / "knowledge_graphs" / "knowledge_graph.json")) | |
| # Ensure directories exist | |
| def ensure_directories(): | |
| """Create necessary directories if they don't exist""" | |
| directories = [ | |
| "logs", | |
| "datasets/db", # ✅ 添加数据库目录 | |
| "datasets/test_results", | |
| "datasets/knowledge_graphs", | |
| "cache", | |
| "evaluation_results" | |
| ] | |
| for directory in directories: | |
| full_path = PROJECT_ROOT / directory | |
| full_path.mkdir(parents=True, exist_ok=True) |