feat: add /api/digest/latest endpoint for scoring digest data
Serves the latest scoring-digest-latest.json from cron output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5463ca0b56
commit
88e8e15c6d
1 changed files with 15 additions and 0 deletions
|
|
@ -1309,3 +1309,18 @@ def register_dashboard_routes(app: web.Application, get_conn):
|
|||
app.router.add_get("/api/pr-lifecycle", handle_pr_lifecycle)
|
||||
app.router.add_get("/api/telegram-extractions", handle_telegram_extractions)
|
||||
app.router.add_get("/api/contributor-growth", handle_contributor_growth)
|
||||
app.router.add_get("/api/digest/latest", handle_digest_latest)
|
||||
|
||||
|
||||
async def handle_digest_latest(request):
|
||||
"""GET /api/digest/latest — return the most recent scoring digest."""
|
||||
import json as _json
|
||||
digest_path = "/opt/teleo-eval/logs/scoring-digest-latest.json"
|
||||
try:
|
||||
with open(digest_path) as f:
|
||||
data = _json.load(f)
|
||||
return web.json_response(data)
|
||||
except FileNotFoundError:
|
||||
return web.json_response({"error": "No digest available yet"}, status=404)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
|
|
|||
Loading…
Reference in a new issue