feat(чат): категории жалоб и attention
This commit is contained in:
@@ -2034,9 +2034,14 @@ async def feedback(request: Request):
|
||||
comment = (body.get("comment") or "").strip()[:2000]
|
||||
answer = (body.get("answer") or "")[:8000]
|
||||
tab_id = _get_tab(request, body)
|
||||
category = (body.get("category") or "").strip()[:40] or None
|
||||
source = (body.get("source") or "chat").strip()[:40] or "chat"
|
||||
allowed = {"wrong_answer", "off_topic", "failure", "praise"}
|
||||
if category is not None and category not in allowed:
|
||||
raise HTTPException(400, "unknown category")
|
||||
if not comment and not answer:
|
||||
raise HTTPException(400, "Empty feedback")
|
||||
await asyncio.to_thread(save_feedback, user, tab_id, comment, answer)
|
||||
await asyncio.to_thread(save_feedback, user, tab_id, comment, answer, category, source)
|
||||
ip = _client_ip(request) or None
|
||||
log_action(user, "feedback", "POST", "/api/feedback", comment[:120], ip, 200)
|
||||
# Жалоба — самый дорогой сигнал: человек не ушёл молча, а потратил силы. Раньше
|
||||
|
||||
Reference in New Issue
Block a user