44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
"""Application configuration."""
|
|
from typing import List
|
|
from pydantic_settings import BaseSettings
|
|
from pydantic import field_validator
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# App
|
|
APP_NAME: str = "AI Worker Platform"
|
|
APP_VERSION: str = "1.1.0"
|
|
SECRET_KEY: str = "dev-secret-key-change-in-production"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # 24 hours
|
|
|
|
# Database
|
|
DATABASE_URL: str = "sqlite:///./ai_worker.db"
|
|
|
|
# Redis
|
|
REDIS_URL: str = ""
|
|
|
|
# LLM Defaults
|
|
DEFAULT_LLM_PROVIDER: str = "deepseek"
|
|
DEFAULT_LLM_API_KEY: str = ""
|
|
DEFAULT_LLM_BASE_URL: str = "https://api.deepseek.com"
|
|
DEFAULT_LLM_MODEL: str = "deepseek-v4-flash"
|
|
|
|
# CORS
|
|
CORS_ORIGINS: str = "http://localhost:5173,http://localhost:3000"
|
|
|
|
@field_validator("CORS_ORIGINS")
|
|
@classmethod
|
|
def parse_cors(cls, v: str) -> str:
|
|
return v
|
|
|
|
@property
|
|
def cors_origins_list(self) -> List[str]:
|
|
return [o.strip() for o in self.CORS_ORIGINS.split(",") if o.strip()]
|
|
|
|
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
|
|
|
|
|
settings = Settings()
|