from typing import Literal from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/adiuvai" JWT_SECRET: str = "change-me-in-production" JWT_ALGORITHM: str = "HS256" JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 JWT_REFRESH_TOKEN_EXPIRE_DAYS: int = 30 STRIPE_SECRET_KEY: str = "" STRIPE_WEBHOOK_SECRET: str = "" OPENAI_API_KEY: str = "" ANTHROPIC_API_KEY: str = "" GOOGLE_API_KEY: str = "" CEREBRAS_API_KEY: str = "" LLM_MODEL: str = "gpt-4o" LLM_EMBED_MODEL: str = "text-embedding-3-small" # Per-agent model overrides. Leave empty to fall back to LLM_MODEL. LLM_MODEL_CLASSIFIER: str = "" # _infer_floating_domain (intent routing) LLM_MODEL_HOME_AGENT: str = "" # home-agent (run_single_agent / stream) LLM_MODEL_FLOATING_AGENT: str = "" # floating-agent (contextual chat) LLM_MODEL_UNIFIED_PROCESSOR: str = "" # unified-processor (agent_runner) LLM_MODEL_CLOUD_PROCESSOR: str = "" # cloud-processor (agent_runner) LLM_MODEL_BRIEF_AGENT: str = "" # brief-agent (home + project text briefs) LLM_MODEL_SETUP_AGENT: str = "" # agent-setup journey LLM_MODEL_MEMORY_EXTRACTOR: str = "" # memory-extractor (Phase 2 extract/decide) LLM_MODEL_MEMORY_MINER: str = "" # memory-miner (Phase 5 proactive mining) LLM_MODEL_MEMORY_AUDITOR: str = "" # memory-auditor (Phase 7 weekly audit) # GitHub Copilot OAuth token storage directory. # Leave empty to use the LiteLLM default (~/.config/litellm/github_copilot). # In Docker, set this to a path backed by a named volume so tokens survive restarts. GITHUB_COPILOT_TOKEN_DIR: str = "" # OAuth client credentials — used for Gmail and Microsoft (Outlook/Teams) flows. GMAIL_CLIENT_ID: str = "" GMAIL_CLIENT_SECRET: str = "" MS_CLIENT_ID: str = "" MS_CLIENT_SECRET: str = "" # MS_TENANT_ID: set to 'common' to allow multi-tenant (personal + work accounts). MS_TENANT_ID: str = "common" # Google Login OAuth credentials — scope: openid email profile. # Separate from GMAIL_CLIENT_ID/SECRET (which uses gmail.readonly scope). GOOGLE_AUTH_CLIENT_ID: str = "" GOOGLE_AUTH_CLIENT_SECRET: str = "" # The redirect URI registered in Google Cloud Console. # Google redirects here after consent; this backend route then bounces to # the adiuvai:// deep link so the Electron app receives the code. # Dev: http://localhost:8000/api/v1/auth/oauth/google/web-callback # Prod: https://api.adiuvai.com/api/v1/auth/oauth/google/web-callback OAUTH_REDIRECT_URI: str = "http://localhost:8000/api/v1/auth/oauth/google/web-callback" # Fernet key (URL-safe base64, 32-byte key) for at-rest encryption of OAuth # tokens stored in cloud_agent_configs.oauth_token_encrypted. # Generate with: from cryptography.fernet import Fernet; Fernet.generate_key() OAUTH_ENCRYPTION_KEY: str = "" CORS_ORIGINS: list[str] = [ "app://.", "http://localhost:3000", "http://localhost:5173", "http://localhost:4173", # Vite preview (web SPA) "https://app.adiuvai.com", # Production web portal ] LANGFUSE_SECRET_KEY: str = "" LANGFUSE_PUBLIC_KEY: str = "" LANGFUSE_BASE_URL: str = "https://cloud.langfuse.com" SCHEDULER_ENABLED: bool = True ENV: Literal["dev", "prod"] = "dev" model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore") settings = Settings()