v1.8.2: AGENTS.md, consent revocation, delete bot users, dialogues fix, intent improvements, CI for max_bot
Tests / test (push) Has been cancelled
Tests / test-max-bot (push) Has been cancelled

This commit is contained in:
2026-06-02 18:22:45 +03:00
parent a64a274829
commit 4c3026a80f
17 changed files with 572 additions and 54 deletions
+21
View File
@@ -796,6 +796,27 @@ async def api_delete_conversation(conv_id: int):
return JSONResponse({"ok": True})
@app.delete("/api/bot/users/{user_id}")
async def api_delete_bot_user(user_id: int):
from app.models import BotMessage, BotProcessingLog
from sqlalchemy import delete as sa_delete
async with async_session() as db:
user = await db.get(BotUser, user_id)
if not user:
return JSONResponse({"ok": False, "error": "Not found"}, status_code=404)
conv_ids_q = await db.execute(
select(BotConversation.id).where(BotConversation.user_id == user_id)
)
conv_ids = [r[0] for r in conv_ids_q.all()]
if conv_ids:
await db.execute(sa_delete(BotProcessingLog).where(BotProcessingLog.conversation_id.in_(conv_ids)))
await db.execute(sa_delete(BotMessage).where(BotMessage.conversation_id.in_(conv_ids)))
await db.execute(sa_delete(BotConversation).where(BotConversation.id.in_(conv_ids)))
await db.delete(user)
await db.commit()
return JSONResponse({"ok": True})
def _extract_phone_from_vcf(vcf_info: str) -> str:
import re
match = re.search(r"TEL[^:]*:(\+?\d[\d\s\-()]*)", vcf_info)