from pydantic_settings import BaseSettings from typing import Optional from functools import lru_cache class Settings(BaseSettings): # Japi Server 配置 host: str = "0.0.0.0" port: int = 8115 debug: bool = False # API路由配置 router_prefix: str = "/jembedding" generate_route: str = "/generate" batch_route: str = "/batch" api_name: str = "jembedding" # Jingrow Jcloud API 配置 jingrow_api_url: str = "https://cloud.jingrow.com" jingrow_api_key: Optional[str] = None jingrow_api_secret: Optional[str] = None class Config: env_file = ".env" @lru_cache() def get_settings() -> Settings: return Settings() # 全局配置实例 settings = get_settings()