Files
ai-g3sb-backman2.0/backend/config/settings.py
T

51 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
配置管理模块
"""
from pydantic_settings import BaseSettings
from typing import Optional, List
class Settings(BaseSettings):
"""应用程序配置"""
# DeepSeek配置
deepseek_api_key: str
deepseek_base_url: str = "https://api.deepseek.com"
model_primary: str = "deepseek-chat"
temperature: float = 0.3
max_tokens: int = 4096
# Embedding / 向量检索(编码走远程 API,见 OPENAI_* / MODELSCOPE_* 等)
vector_dim: int = 2048
# Schema配置
schema_dir: str = "./data/schemas"
schema_file: Optional[str] = None # 特定schema文件路径
vector_db_path: str = "./data/embeddings/chroma"
# 验证配置
enable_sql_validation: bool = True
block_dangerous_sql: bool = True
dangerous_keywords: List[str] = ["DROP", "DELETE", "UPDATE", "INSERT", "ALTER", "TRUNCATE"]
# 重试配置
max_retry: int = 2
retry_delay: float = 1.0
# 日志配置
log_level: str = "INFO"
log_file: Optional[str] = None
# 业务库(backend/db:execute_sql / search_objects);与 .env 中 database_url 一致
database_url: Optional[str] = None
sql_max_rows: int = 10000
class Config:
env_file = ".env"
case_sensitive = False
# 全局配置实例
settings = Settings()