INNER CODE UNIT · Python
frontend_config
pathwaycom/llm-app · serviette/frontend/main.py:77
async def frontend_config() -> JSONResponse:
# Informational only (shown in the header); no secrets here.
return JSONResponse({"title": fe.title, "api_url": fe.api_url})
async def _proxy(name: str, request: Request) -> JSONResponse:
try:
body = await request.json()
except Exception: # noqa: BLE001 - any malformed body proxies as empty
body = {}
assert client is not None # created in lifespan before serving
try:
upstream = await client.post(_PROXY_ROUTES[name], json=body)
except httpx.HTTPError as exc:
return JSONResponse(
{"detail": f"Could not reach the API at {fe.api_url}: {exc}"},
status_code=502,
)
try: