From e2143aa173c71e1fdc930db4a18b1e3cfd98f270 Mon Sep 17 00:00:00 2001 From: 9qeklajc Date: Thu, 14 May 2026 15:51:20 +0200 Subject: [PATCH] Revert "fix home nav" This reverts commit 2eb257c2a6760ae507d317758b21f94f1f46be31. --- routstr/core/main.py | 17 ++--------------- routstr/proxy.py | 17 +---------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/routstr/core/main.py b/routstr/core/main.py index 4c679e44..535480a2 100644 --- a/routstr/core/main.py +++ b/routstr/core/main.py @@ -268,21 +268,8 @@ if UI_DIST_PATH.exists() and UI_DIST_PATH.is_dir(): ) @app.get("/", include_in_schema=False) - async def serve_root_ui() -> StarletteResponse: - index = UI_DIST_PATH / "index.html" - if index.exists(): - return FileResponse(index) - # UI directory exists but the index page is missing — return a basic - # status payload so the home page never 404s. - from fastapi.responses import JSONResponse as _JSONResponse - - return _JSONResponse( - { - "name": global_settings.name, - "version": __version__, - "status": "running", - } - ) + async def serve_root_ui() -> FileResponse: + return FileResponse(UI_DIST_PATH / "index.html") # Serve the App Router RSC payload for the home page. @app.get("/index.txt", include_in_schema=False) diff --git a/routstr/proxy.py b/routstr/proxy.py index f416a302..01bb753b 100644 --- a/routstr/proxy.py +++ b/routstr/proxy.py @@ -2,7 +2,7 @@ import json from typing import Any from fastapi import APIRouter, Depends, HTTPException, Request -from fastapi.responses import JSONResponse, Response, StreamingResponse +from fastapi.responses import Response, StreamingResponse from sqlmodel import select from .algorithm import create_model_mappings @@ -174,21 +174,6 @@ async def proxy( # so that OpenAI-style endpoints work with or without the `v1/` prefix # (e.g. `/chat/completions` as well as `/v1/chat/completions`). if request.method == "GET" and not path.startswith(_API_PATH_PREFIXES): - # An empty path means the root `/` reached the catch-all because no - # explicit handler matched (e.g. the UI bundle is missing from the - # deploy). Return a small status payload instead of a 404 so that the - # home page never appears broken. - if not path: - from .core.version import __version__ - - return JSONResponse( - status_code=200, - content={ - "name": settings.name, - "version": __version__, - "status": "running", - }, - ) return build_not_found_response(request, path) headers = dict(request.headers)