feat(5.2): жалобы в админке — /api/admin/feedback + раздел «Жалобы» (textContent, без XSS)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
anor
2026-06-11 01:14:12 +10:00
co-authored by Claude Fable 5
parent 0e8f3bd1c2
commit c2c2c309c6
2 changed files with 46 additions and 1 deletions
+9 -1
View File
@@ -13,7 +13,7 @@ from fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Streamin
from fastapi.staticfiles import StaticFiles
from auth import authenticate, verify_token, make_download_ticket, verify_download_ticket
from db import clear_history, get_audit_log, get_history, get_history_any_user, init_db, list_sessions, log_action, ping as db_ping, save_feedback, save_message
from db import clear_history, get_audit_log, get_feedback, get_history, get_history_any_user, init_db, list_sessions, log_action, ping as db_ping, save_feedback, save_message
from tus_upload import register_tus
# Backend: "claude" (Docker sandbox), "glm" (GLM-5 + CAG), "auto" (route by task)
@@ -883,6 +883,14 @@ async def admin_audit(request: Request):
return get_audit_log(limit, offset, username, action)
@app.get("/api/admin/feedback")
async def admin_feedback(request: Request):
"""Жалобы пользователей на ответы («сообщить об ошибке») — admin only."""
_require_admin(request)
limit = int(request.query_params.get("limit", "200"))
return get_feedback(limit)
@app.get("/api/admin/stats")
async def admin_stats(request: Request):
"""Dashboard stats: messages per day, total sessions, etc."""