v1.7.0: refactor max_bot to flat structure, add VCF+UserModel+NLP history context, portal pages and proxy fixes
- Refactored max_bot from nested packages to flat module structure - Q2: Extended BotUser model (patronymic, email, org, address, vcf_raw, contact_hash, phone_verified, email_verified, last_interaction, total_conversations, total_tickets) - Q2: VCF parser (FN, N, TEL, EMAIL, ORG, ADR), upsert on re-contact, NLP history context (_get_user_history_context -> YandexGPT) - Q1: Broadcast preview modal with 10s confirmation timer - Q3: CSS var(--white)->var(--bg-card), var(--text)->var(--text-primary) - Q4: bot_settings showNotification(), editable max_bot_id - Q5: Webhook secret passthrough via X-Max-Bot-Api-Secret - Masking sensitive keys, dialog_cleared handler, migrate via _add_column_if_not_exists() - Rate limit (asyncio.sleep 0.5 per 10), dead code removed, conv.intent context in contact.py - Portal pages: bot_consent, bot_kb (edit), bot_settings, bot_test, bot_tickets, portal_settings - Tests: 21/21 passing, added test_yandex_gpt.py, test_email_sender.py - Deploy: deploy_full.sh, schema.sql, seed_knowledge_base.sql
This commit is contained in:
@@ -133,23 +133,6 @@ ROUTE_PERMISSIONS: dict[tuple[str, str], tuple[str, ...]] = {
|
||||
("POST", "/service/cases/edit"): ("owner",),
|
||||
("POST", "/service/cases/delete"): ("owner",),
|
||||
|
||||
# === BOT SETTINGS (pages) ===
|
||||
("GET", "/service/bot-settings"): ("owner",),
|
||||
("GET", "/service/bot-settings/responses"): ("owner",),
|
||||
("GET", "/service/bot-settings/features"): ("owner",),
|
||||
("GET", "/service/bot-settings/categories"): ("owner",),
|
||||
("GET", "/service/bot-settings/kb"): ("owner",),
|
||||
("GET", "/service/bot-settings/conversations"): ("owner",),
|
||||
("GET", "/service/bot-settings/users"): ("owner",),
|
||||
("GET", "/service/bot-settings/test-runner"): ("owner",),
|
||||
("GET", "/service/bot-settings/analytics"): ("owner",),
|
||||
("GET", "/service/bot-settings/risk-questions"): ("owner",),
|
||||
("GET", "/service/bot-settings/handoffs"): ("owner",),
|
||||
("GET", "/service/bot-settings/notifications"): ("owner",),
|
||||
("GET", "/service/bot-settings/broadcasts"): ("owner",),
|
||||
("GET", "/service/bot-settings/storage"): ("owner",),
|
||||
("GET", "/service/bot-settings/tickets"): ("owner",),
|
||||
|
||||
# === PORTAL / ROLE SETTINGS ===
|
||||
("GET", "/service/portal-settings"): ("owner",),
|
||||
("GET", "/service/role-settings"): ("owner",),
|
||||
@@ -162,57 +145,6 @@ ROUTE_PERMISSIONS: dict[tuple[str, str], tuple[str, ...]] = {
|
||||
("POST", "/service/api/role/switch"): ("owner", "engineer"),
|
||||
("POST", "/service/api/role/reset"): ("authenticated",),
|
||||
|
||||
# === BOT API (proxied) ===
|
||||
("GET", "/service/api/bot/settings"): ("owner",),
|
||||
("POST", "/service/api/bot/settings/save"): ("owner",),
|
||||
("GET", "/service/api/bot/templates"): ("owner",),
|
||||
("POST", "/service/api/bot/templates/save"): ("owner",),
|
||||
("GET", "/service/api/bot/features"): ("owner",),
|
||||
("POST", "/service/api/bot/features/toggle"): ("owner",),
|
||||
("GET", "/service/api/bot/categories"): ("owner",),
|
||||
("POST", "/service/api/bot/categories/create"): ("owner",),
|
||||
("POST", "/service/api/bot/categories/edit"): ("owner",),
|
||||
("POST", "/service/api/bot/categories/delete"): ("owner",),
|
||||
("GET", "/service/api/bot/kb"): ("owner",),
|
||||
("POST", "/service/api/bot/kb/create"): ("owner",),
|
||||
("POST", "/service/api/bot/kb/edit"): ("owner",),
|
||||
("POST", "/service/api/bot/kb/delete"): ("owner",),
|
||||
("GET", "/service/api/bot/conversations"): ("owner",),
|
||||
("GET", "/service/api/bot/users"): ("owner",),
|
||||
("GET", "/service/api/bot/analytics"): ("owner",),
|
||||
("POST", "/service/api/bot/test-run"): ("owner",),
|
||||
("GET", "/service/api/bot/broadcast/recipients"): ("owner",),
|
||||
("GET", "/service/api/bot/broadcast/history"): ("owner",),
|
||||
("POST", "/service/api/bot/broadcast"): ("owner",),
|
||||
|
||||
# === BOT RISK QUESTIONS ===
|
||||
("GET", "/service/api/bot/risk-questions"): ("owner",),
|
||||
("POST", "/service/api/bot/risk-questions/create"): ("owner",),
|
||||
("POST", "/service/api/bot/risk-questions/edit"): ("owner",),
|
||||
("POST", "/service/api/bot/risk-questions/toggle"): ("owner",),
|
||||
("POST", "/service/api/bot/risk-questions/delete"): ("owner",),
|
||||
|
||||
# === BOT STORAGE ===
|
||||
("GET", "/service/api/bot/storage/list"): ("owner",),
|
||||
("GET", "/service/api/bot/storage/search"): ("owner",),
|
||||
("GET", "/service/api/bot/storage/public-link"): ("owner",),
|
||||
("GET", "/service/api/bot/storage/download"): ("owner",),
|
||||
|
||||
# === BOT TICKETS ===
|
||||
("GET", "/service/api/bot/tickets"): ("owner",),
|
||||
("GET", "/service/api/bot/tickets/{ticket_id}"): ("owner",),
|
||||
("POST", "/service/api/bot/tickets/create"): ("owner",),
|
||||
("POST", "/service/api/bot/tickets/{ticket_id}/message"): ("owner",),
|
||||
("POST", "/service/api/bot/tickets/{ticket_id}/status"): ("owner",),
|
||||
("GET", "/service/api/bot/engineers"): ("owner",),
|
||||
|
||||
# === BOT HANDOFFS / NOTIFICATIONS (non-standard paths) ===
|
||||
("GET", "/service/bot-settings/handoffs/poll"): ("owner",),
|
||||
("POST", "/service/bot-settings/handoffs/{handoff_id}/take"): ("owner",),
|
||||
("POST", "/service/api/bot/handoffs/{handoff_id}/close"): ("owner",),
|
||||
("GET", "/service/bot-settings/notifications/data"): ("owner",),
|
||||
("POST", "/service/bot-settings/notifications/{notif_id}/read"): ("owner",),
|
||||
|
||||
# === OTHER API (main.py) ===
|
||||
("GET", "/service/api/shs"): ("owner", "engineer", "technician"),
|
||||
("GET", "/service/api/tasks"): ("owner", "engineer", "technician"),
|
||||
@@ -241,12 +173,6 @@ DYNAMIC_ROUTES: set[tuple[str, str]] = {
|
||||
("GET", "/service/documents/{slug}/edit"),
|
||||
("POST", "/service/documents/{slug}/edit"),
|
||||
("GET", "/service/documents/{slug}/download"),
|
||||
("POST", "/service/bot-settings/handoffs/{handoff_id}/take"),
|
||||
("POST", "/service/bot-settings/notifications/{notif_id}/read"),
|
||||
("POST", "/service/api/bot/handoffs/{handoff_id}/close"),
|
||||
("GET", "/service/api/bot/tickets/{ticket_id}"),
|
||||
("POST", "/service/api/bot/tickets/{ticket_id}/message"),
|
||||
("POST", "/service/api/bot/tickets/{ticket_id}/status"),
|
||||
}
|
||||
|
||||
# Routes excluded from discover test (internal framework routes)
|
||||
|
||||
Reference in New Issue
Block a user