2026-03-19 17:55:39 +08:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
2026-02-04 17:57:49 +08:00
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
from pydantic import Field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
"""
|
|
|
|
|
应用配置类。Pydantic Settings 会自动从环境变量和 .env 文件中加载这些值。
|
|
|
|
|
"""
|
|
|
|
|
model_config = SettingsConfigDict(
|
2026-02-06 12:01:55 +08:00
|
|
|
env_file='.env',
|
2026-02-04 17:57:49 +08:00
|
|
|
env_file_encoding='utf-8',
|
|
|
|
|
extra='ignore' # 忽略环境变量中多余的键
|
|
|
|
|
)
|
|
|
|
|
# --- google api 配置信息 ---
|
|
|
|
|
GOOGLE_GENAI_USE_VERTEXAI: str = Field(default="", description="")
|
|
|
|
|
GOOGLE_API_KEY: str = Field(default="", description="")
|
2026-02-06 11:55:11 +08:00
|
|
|
GOOGLE_CLOUD_PROJECT: str = Field(default="", description="")
|
|
|
|
|
GOOGLE_CLOUD_LOCATION: str = Field(default="", description="")
|
|
|
|
|
|
2026-03-03 17:33:51 +08:00
|
|
|
# --- google api 配置信息 ---
|
|
|
|
|
QWEN_API_KEY: str = Field(default="", description="")
|
|
|
|
|
|
2026-02-06 11:55:11 +08:00
|
|
|
# --- minio 配置信息 ---
|
|
|
|
|
MINIO_URL: str = Field(default='', description="")
|
|
|
|
|
MINIO_ACCESS: str = Field(default='', description="")
|
|
|
|
|
MINIO_SECRET: str = Field(default='', description="")
|
|
|
|
|
MINIO_SECURE: bool = Field(default=True, description="")
|
2026-02-04 17:57:49 +08:00
|
|
|
|
2026-03-31 18:16:28 +08:00
|
|
|
# --- redis 配置信息 ---
|
|
|
|
|
REDIS_HOST: str = Field(default='', description="")
|
|
|
|
|
REDIS_PORT: str = Field(default='', description="")
|
|
|
|
|
REDIS_DB: int = Field(default=0, description="")
|
|
|
|
|
|
2026-02-04 17:57:49 +08:00
|
|
|
# --- mongodb配置信息 ---
|
|
|
|
|
MONGODB_USERNAME: str = Field(default="", description="")
|
|
|
|
|
MONGODB_PASSWORD: str = Field(default="", description="")
|
|
|
|
|
MONGODB_HOST: str = Field(default="localhost", description="")
|
|
|
|
|
MONGODB_PORT: int = Field(default=27017, description="")
|
|
|
|
|
|
2026-03-17 16:02:04 +08:00
|
|
|
# --- 本地服务器配置信息 ---
|
|
|
|
|
IMAGE_TO_3D_MODEL_URL: str = Field(default='', description="")
|
2026-03-18 12:21:08 +08:00
|
|
|
FLUX2_GEN_IMG_MODEL_URL: str = Field(default='', description="")
|
2026-03-27 14:41:13 +08:00
|
|
|
SEG_ANYTHING: str = Field(default='', description="")
|
2026-03-31 18:16:28 +08:00
|
|
|
RABBITMQ_URL: str = Field(default='', description="")
|
2026-03-17 16:02:04 +08:00
|
|
|
|
2026-03-03 17:33:51 +08:00
|
|
|
# --- 外部工具api配置信息 ---
|
|
|
|
|
TAVILY_API_KEY: str = Field(default="", description="")
|
|
|
|
|
|
|
|
|
|
LOGS_PATH: str = Field(default="/mnt/data/FiDA/logs", description="")
|
|
|
|
|
|
2026-02-04 17:57:49 +08:00
|
|
|
|
|
|
|
|
settings = Settings()
|
|
|
|
|
MONGO_URI = f"mongodb://{settings.MONGODB_USERNAME}:{settings.MONGODB_PASSWORD}@{settings.MONGODB_HOST}:{settings.MONGODB_PORT}"
|
2026-03-19 17:55:39 +08:00
|
|
|
|
|
|
|
|
TOOL_DIR = Path(__file__).resolve().parent
|
|
|
|
|
PROJECT_ROOT = TOOL_DIR.parent
|
|
|
|
|
print(f"PROJECT_ROOT : {PROJECT_ROOT}")
|