GET /v1/stats/recent — recent routed requests with feedback status.
(request: Request)
| 3746 | }, status_code=200 if result.ok else 404) |
| 3747 | |
| 3748 | async def handle_recent(request: Request) -> JSONResponse: |
| 3749 | """GET /v1/stats/recent — recent routed requests with feedback status.""" |
| 3750 | limit = int(request.query_params.get("limit", "30")) |
| 3751 | records = _stats.recent(max(limit * 3, limit)) |
| 3752 | visible_records: list[dict[str, Any]] = [] |
| 3753 | for r in records: |
| 3754 | has_result = bool(r.get("feedback_action")) |
| 3755 | r["feedback_pending"] = (not has_result) and _feedback.has_pending(r["request_id"]) |
| 3756 | if has_result or r["feedback_pending"]: |
| 3757 | visible_records.append(r) |
| 3758 | if len(visible_records) >= limit: |
| 3759 | break |
| 3760 | return JSONResponse(visible_records) |
| 3761 | |
| 3762 | async def handle_events_stream(request: Request) -> Response: |
| 3763 | """GET /v1/events/stream — Server-Sent Events for live dashboard updates.""" |
nothing calls this directly
no test coverage detected