Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
0e6ce7b
1
Parent(s): 2fa7104
Fix config path to use absolute path from project root
Browse filesThe config was using a relative path which failed when running from
the backend directory. Now uses Path(__file__).parent.parent to get
project root and build absolute path to configs/main_agent_config.json.
Verified: health check returns 200 OK
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
backend/session_manager.py
CHANGED
|
@@ -5,6 +5,7 @@ import logging
|
|
| 5 |
import uuid
|
| 6 |
from dataclasses import dataclass, field
|
| 7 |
from datetime import datetime
|
|
|
|
| 8 |
from typing import Any, Optional
|
| 9 |
|
| 10 |
from agent.config import load_config
|
|
@@ -13,6 +14,10 @@ from agent.core.session import Event, OpType, Session
|
|
| 13 |
from agent.core.tools import ToolRouter
|
| 14 |
from websocket import manager as ws_manager
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# These dataclasses match agent/main.py structure
|
| 18 |
@dataclass
|
|
@@ -49,8 +54,8 @@ class AgentSession:
|
|
| 49 |
class SessionManager:
|
| 50 |
"""Manages multiple concurrent agent sessions."""
|
| 51 |
|
| 52 |
-
def __init__(self, config_path: str =
|
| 53 |
-
self.config = load_config(config_path)
|
| 54 |
self.sessions: dict[str, AgentSession] = {}
|
| 55 |
self._lock = asyncio.Lock()
|
| 56 |
|
|
|
|
| 5 |
import uuid
|
| 6 |
from dataclasses import dataclass, field
|
| 7 |
from datetime import datetime
|
| 8 |
+
from pathlib import Path
|
| 9 |
from typing import Any, Optional
|
| 10 |
|
| 11 |
from agent.config import load_config
|
|
|
|
| 14 |
from agent.core.tools import ToolRouter
|
| 15 |
from websocket import manager as ws_manager
|
| 16 |
|
| 17 |
+
# Get project root (parent of backend directory)
|
| 18 |
+
PROJECT_ROOT = Path(__file__).parent.parent
|
| 19 |
+
DEFAULT_CONFIG_PATH = str(PROJECT_ROOT / "configs" / "main_agent_config.json")
|
| 20 |
+
|
| 21 |
|
| 22 |
# These dataclasses match agent/main.py structure
|
| 23 |
@dataclass
|
|
|
|
| 54 |
class SessionManager:
|
| 55 |
"""Manages multiple concurrent agent sessions."""
|
| 56 |
|
| 57 |
+
def __init__(self, config_path: str | None = None) -> None:
|
| 58 |
+
self.config = load_config(config_path or DEFAULT_CONFIG_PATH)
|
| 59 |
self.sessions: dict[str, AgentSession] = {}
|
| 60 |
self._lock = asyncio.Lock()
|
| 61 |
|