feat: клик по модели — лог всех проверок с ошибками
Build and deploy / build-deploy (push) Has been cancelled

Кнопка 📋 Лог открывает /api/checks/{model_id} — все проверки модели
за период (по умолчанию 100 последних, limit через CHECKS_LIMIT) с
ok/latency_ms/checked_at/error. Заполняет history для перерисовки.
This commit is contained in:
2026-10-22 08:48:00 +00:00
parent 1fb770fc52
commit 463d80c4fe
2 changed files with 36 additions and 0 deletions
+25
View File
@@ -536,6 +536,31 @@ def api_check(model_id: str):
}
@app.get("/api/checks/{model_id:path}")
def api_checks(model_id: str):
"""Все проверки модели за период — для дропдауна с деталями ошибок."""
limit = int(os.environ.get("CHECKS_LIMIT", "100"))
db = get_db()
rows = db.execute(
"SELECT ok, latency_ms, checked_at, error FROM checks "
"WHERE model_id=? ORDER BY checked_at DESC LIMIT ?",
(model_id, limit),
).fetchall()
db.close()
return {
"model_id": model_id,
"checks": [
{
"ok": bool(r["ok"]),
"latency_ms": r["latency_ms"],
"checked_at": r["checked_at"],
"error": r["error"],
}
for r in rows
],
}
@app.get("/", response_class=HTMLResponse)
def index():
with open("/app/app/static/index.html") as f: