Skip to content

Commit ed40ad1

Browse files
author
Dylan Huang
committed
fix app route ordering
1 parent a41689c commit ed40ad1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

eval_protocol/utils/logs_server.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ def __init__(
266266
if elasticsearch_config:
267267
self.elasticsearch_client = ElasticsearchClient(elasticsearch_config)
268268

269-
super().__init__(build_dir, host, port if port is not None else 8000, index_file)
269+
self.app = FastAPI(title="Logs Server")
270+
271+
# Add WebSocket endpoint and API routes
272+
self._setup_websocket_routes()
273+
self._setup_api_routes()
274+
275+
super().__init__(build_dir, host, port if port is not None else 8000, index_file, self.app)
270276

271277
# Add CORS middleware to allow frontend access
272278
allowed_origins = [
@@ -287,9 +293,12 @@ def __init__(
287293
# Initialize evaluation watcher
288294
self.evaluation_watcher = EvaluationWatcher(self.websocket_manager)
289295

290-
# Add WebSocket endpoint and API routes
291-
self._setup_websocket_routes()
292-
self._setup_api_routes()
296+
# Log all registered routes for debugging
297+
logger.info("Registered routes:")
298+
for route in self.app.routes:
299+
path = getattr(route, "path", "UNKNOWN")
300+
methods = getattr(route, "methods", {"UNKNOWN"})
301+
logger.info(f" {methods} {path}")
293302

294303
# Subscribe to events and start listening for cross-process events
295304
event_bus.subscribe(self._handle_event)

eval_protocol/utils/vite_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ def __init__(
3232
host: str = "localhost",
3333
port: int = 8000,
3434
index_file: str = "index.html",
35-
lifespan: Optional[Callable[[FastAPI], Any]] = None,
35+
app: Optional[FastAPI] = None,
3636
):
3737
self.build_dir = Path(build_dir)
3838
self.host = host
3939
self.port = port
4040
self.index_file = index_file
41-
self.app = FastAPI(title="Vite SPA Server", lifespan=lifespan)
41+
self.app = app if app is not None else FastAPI(title="Vite SPA Server")
4242

4343
# Validate build directory exists
4444
if not self.build_dir.exists():

0 commit comments

Comments
 (0)