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:
2026-05-29 02:30:30 +03:00
parent 493e0b37a1
commit 72b6879f4b
234 changed files with 26768 additions and 6240 deletions
+15 -17
View File
@@ -1,24 +1,22 @@
import os
from pathlib import Path
from typing import List, Optional
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
DATABASE_URL: str = "postgresql+asyncpg://aegisone:aegisone_pass@localhost:5432/aegisone"
APP_ENV: str = "development"
LOG_LEVEL: str = "debug"
WEBHOOK_PATH: str = "/webhook"
WEBHOOK_SECRET: str = "change-me-to-random-secret"
UPLOADS_DIR: str = str(Path(__file__).parent.parent / "uploads" / "bot")
YANDEX_DISK_TOKEN: str = ""
YANDEX_DISK_ROOT: str = "/AegisOne_Service"
database_url: str = "postgresql+asyncpg://aegisone:aegisone_pass@localhost:5432/aegisone"
max_token: str = "f9LHodD0cOKkk03DYXj906MdIeRs3HdDo0BC5H2fLMVCMz3PA_Vx4aJqt2l2qPLM5zd5EQ1Zh6APxzpw2UYE"
max_api_base: str = "https://platform-api.max.ru"
webhook_url: str = "https://max.aegisone.ru/webhook"
webhook_secret: str = "aegisone_bot_secret_2026"
config_php_path: str = "/var/www/html/config.php"
php_sendmail_path: str = "/usr/sbin/sendmail"
default_assistant_name: str = "София"
default_assistant_role: str = "Представитель компании AegisOne Engineering, помогающий клиентам с запросами по безопасности"
default_support_email: str = "zakaz@aegisone.ru"
default_email_subject: str = "Обращение через Виртуального помощника AegisOne Engineering"
update_types: List[str] = ["bot_started", "message_created", "message_callback"]
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
model_config = {"env_prefix": "BOT_", "env_file": ".env"}
@lru_cache()
def get_settings() -> Settings:
return Settings()
settings = Settings()