first commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
配置管理模块
|
||||
"""
|
||||
|
||||
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配置
|
||||
embedding_model_path: str = "./data/models/Qwen3-Embedding-0.6B"
|
||||
vector_dim: int = 2048
|
||||
use_local_embedding: bool = True
|
||||
|
||||
# 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
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
case_sensitive = False
|
||||
|
||||
|
||||
# 全局配置实例
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user