MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / handle_recent

Function handle_recent

uncommon_route/proxy.py:3748–3760  ·  view source on GitHub ↗

GET /v1/stats/recent — recent routed requests with feedback status.

(request: Request)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 4

has_pendingMethod · 0.80
getMethod · 0.45
recentMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected