from pydantic_settings import BaseSettings from typing import Optional class Settings(BaseSettings): """服务配置""" # 服务基本配置 HOST: str = "0.0.0.0" PORT: int = 8001 DEBUG: bool = True # 服务名称 SERVICE_NAME: str = "text-classification" # 日志配置 LOG_LEVEL: str = "info" # 算法配置 ALGORITHM_THRESHOLD: float = 0.5 class Config: env_file = ".env" case_sensitive = True # 创建全局配置实例 settings = Settings()