File size: 2,110 Bytes
582520a a6e51ba 582520a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | """Application settings loaded from environment."""
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Runtime configuration for ReplyFlow."""
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
app_name: str = "ReplyFlow"
app_env: str = "production"
secret_key: str = "change-me"
public_base_url: str = "http://localhost:7860"
database_url: str = (
"sqlite+aiosqlite:///./data/db/replyflow.db"
)
chroma_path: str = "./data/chroma"
knowledge_path: str = "./data/knowledge"
# Always use JSON fallback on Spaces (no Chroma).
use_json_store: bool = True
# Seed with local embeddings so startup never waits on OpenAI.
seed_local_embeddings: bool = True
openai_api_key: str = ""
openai_model: str = "gpt-4o-mini"
openai_embedding_model: str = "text-embedding-3-small"
calcom_api_key: str = ""
calcom_event_type_id: str = ""
calcom_username: str = ""
whatsapp_token: str = ""
whatsapp_phone_number_id: str = ""
whatsapp_verify_token: str = "replyflow-verify"
whatsapp_app_secret: str = ""
handoff_webhook_url: str = ""
demo_business_name: str = "Nordic Paper Solutions"
demo_timezone: str = "Europe/Paris"
@property
def has_openai(self) -> bool:
"""True when an OpenAI API key is configured."""
return bool(self.openai_api_key.strip())
@property
def has_calcom(self) -> bool:
"""True when Cal.com credentials are configured."""
return bool(
self.calcom_api_key.strip()
and self.calcom_event_type_id.strip()
)
@property
def has_whatsapp(self) -> bool:
"""True when WhatsApp credentials are configured."""
return bool(
self.whatsapp_token.strip()
and self.whatsapp_phone_number_id.strip()
)
@lru_cache
def get_settings() -> Settings:
"""Return cached settings instance."""
return Settings()
|