39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
from functools import lru_cache
|
|
|
|
from pydantic import Field
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
app_name: str = "财务大模型智能问答客服系统"
|
|
environment: str = "development"
|
|
database_url: str = "sqlite:///./finance_ai.db"
|
|
jwt_secret_key: str = Field(default="dev-secret-change-me")
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_expire_minutes: int = 480
|
|
sms_provider: str = "mock"
|
|
adp_provider: str = "mock"
|
|
storage_provider: str = "local"
|
|
local_storage_dir: str = "./storage"
|
|
allowed_origins: str = "http://localhost:5173,http://127.0.0.1:5173,http://localhost"
|
|
|
|
adp_bot_app_key: str = ""
|
|
adp_knowledge_biz_id: str = ""
|
|
adp_endpoint: str = "https://wss.lke.cloud.tencent.com/adp/v2/chat"
|
|
adp_timeout_seconds: int = 120
|
|
|
|
tencent_secret_id: str = ""
|
|
tencent_secret_key: str = ""
|
|
tencent_region: str = "ap-guangzhou"
|
|
|
|
@property
|
|
def cors_origins(self) -> list[str]:
|
|
return [origin.strip() for origin in self.allowed_origins.split(",") if origin.strip()]
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|