From 79b7f5f579680bbeb97e450370515b116ede8d66 Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 13:30:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20AI=20Worker=20=E5=B9=B3=E5=8F=B0=20MVP?= =?UTF-8?q?=20v1.0.0=20-=20=E5=A4=9A=E7=A7=9F=E6=88=B7/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86/AI=20Worker/=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E6=8E=92/HITL=E5=AE=A1=E6=A0=B8/=E6=88=90=E6=9C=AC=E6=B2=BB?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/config.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 backend/app/config.py diff --git a/backend/app/config.py b/backend/app/config.py new file mode 100644 index 0000000..bc961ca --- /dev/null +++ b/backend/app/config.py @@ -0,0 +1,43 @@ +"""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.0.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 = "openai" + DEFAULT_LLM_API_KEY: str = "" + DEFAULT_LLM_BASE_URL: str = "https://api.openai.com/v1" + DEFAULT_LLM_MODEL: str = "gpt-4o-mini" + + # 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()