2026-06-27 14:07:10 +03:00
|
|
|
from functools import lru_cache
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
|
|
|
|
|
|
app_env: str = "production"
|
|
|
|
|
public_base_url: str = "https://dzen.nstarikov.ru"
|
|
|
|
|
|
|
|
|
|
sqlite_path: str = "/app/data/dzen.sqlite3"
|
|
|
|
|
storage_dir: str = "/app/data"
|
|
|
|
|
|
|
|
|
|
redis_url: str = "redis://redis:6379/0"
|
|
|
|
|
celery_broker_url: str = "redis://redis:6379/0"
|
|
|
|
|
celery_result_backend: str = "redis://redis:6379/1"
|
|
|
|
|
|
|
|
|
|
admin_token: str = "change-me"
|
2026-08-11 12:47:48 +03:00
|
|
|
webauthn_rp_id: str = "dzen.nstarikov.ru"
|
|
|
|
|
webauthn_rp_name: str = "Дзен-ассистент"
|
|
|
|
|
webauthn_origin: str = "https://dzen.nstarikov.ru"
|
|
|
|
|
auth_session_ttl_seconds: int = 2592000
|
|
|
|
|
vk_id_app_id: int = 54716062
|
|
|
|
|
vk_id_allowed_user_id: int = 32018
|
|
|
|
|
vk_id_user_info_url: str = "https://id.vk.com/oauth2/user_info"
|
2026-06-27 14:07:10 +03:00
|
|
|
whisper_command: str = "/LLM/Whisper/whisper --model medium --language ru --output_format txt"
|
|
|
|
|
ytdlp_cookies_path: str = "/app/data/cookies.txt"
|
|
|
|
|
vk_api_token: str = ""
|
|
|
|
|
vk_video_owner_id: str = "-9828339"
|
|
|
|
|
|
|
|
|
|
llm_api_url: str = ""
|
|
|
|
|
llm_api_key: str = ""
|
|
|
|
|
llm_model: str = "agent"
|
|
|
|
|
llm_timeout_seconds: int = 120
|
2026-08-08 14:02:14 +03:00
|
|
|
llm_max_transcript_chars: int = 24000
|
|
|
|
|
llm_retry_attempts: int = 3
|
2026-06-27 14:07:10 +03:00
|
|
|
|
|
|
|
|
max_concurrent_videos: int = 1
|
|
|
|
|
frame_candidates: int = 12
|
|
|
|
|
rss_limit: int = 100
|
2026-08-08 14:02:14 +03:00
|
|
|
whisper_chunk_seconds: int = 600
|
|
|
|
|
whisper_chunk_min_duration_seconds: int = 1800
|
2026-06-27 14:07:10 +03:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def sqlite_url(self) -> str:
|
|
|
|
|
return f"sqlite:///{self.sqlite_path}"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def storage_path(self) -> Path:
|
|
|
|
|
return Path(self.storage_dir)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def media_path(self) -> Path:
|
|
|
|
|
return self.storage_path / "media"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def videos_path(self) -> Path:
|
|
|
|
|
return self.storage_path / "videos"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def transcripts_path(self) -> Path:
|
|
|
|
|
return self.storage_path / "transcripts"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def posts_path(self) -> Path:
|
|
|
|
|
return self.storage_path / "posts"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@lru_cache
|
|
|
|
|
def get_settings() -> Settings:
|
|
|
|
|
return Settings()
|