INNER CODE UNIT · Python
stats
pathwaycom/llm-app · serviette/frontend/main.py:101
async def stats() -> JSONResponse:
assert client is not None # created in lifespan before serving
try:
upstream = await client.get("/api/v1/stats")
except httpx.HTTPError:
return JSONResponse({"stats_available": False}, status_code=502)
try:
payload = upstream.json()
except ValueError:
payload = {"stats_available": False}
return JSONResponse(payload, status_code=upstream.status_code)
@app.get("/api/v1/documents")
async def documents(request: Request) -> JSONResponse:
# The document panel's search: forwarded with its query string.
assert client is not None # created in lifespan before serving
try:
upstream = await client.get(