39 lines
780 B
Python
39 lines
780 B
Python
"""
|
|
app/config.py - 应用配置管理
|
|
"""
|
|
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置"""
|
|
|
|
# API 配置
|
|
api_key: str
|
|
model: str = "gemini-3.1-flash"
|
|
base_url: str = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
|
|
|
# FastAPI 配置
|
|
fastapi_host: str = "0.0.0.0"
|
|
fastapi_port: int = 8000
|
|
fastapi_debug: bool = True
|
|
|
|
# LangGraph 配置
|
|
langgraph_debug: bool = False
|
|
|
|
# 项目信息
|
|
project_name: str = "AI Agent Project"
|
|
project_version: str = "0.1.0"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
"""获取应用配置的单例"""
|
|
return Settings()
|
|
|