| from __future__ import annotations | |
| import logging | |
| from fastapi import APIRouter | |
| from fastapi.responses import JSONResponse | |
| from app.clients.hana_client import hana_client | |
| from app.config import settings | |
| LOG = logging.getLogger(__name__) | |
| router = APIRouter() | |
| async def get_models(): | |
| """Return available Neon models (fresh from HANA) and comparison providers.""" | |
| try: | |
| neon_models = await hana_client.get_models() | |
| except Exception as exc: | |
| LOG.warning("HANA unavailable — Neon models will be empty: %s", exc) | |
| neon_models = [] | |
| comparison_providers = [] | |
| for p in settings.comparison_providers: | |
| comparison_providers.append({ | |
| "id": p["id"], | |
| "name": p["name"], | |
| "models": p["models"], | |
| }) | |
| return JSONResponse( | |
| content={ | |
| "neon_models": neon_models, | |
| "comparison_providers": comparison_providers, | |
| }, | |
| headers={"Cache-Control": "no-store"}, | |
| ) | |