Files
AIRegulation-DocAnalysis/backend/app/core/config.py

55 lines
1.5 KiB
Python
Raw Permalink Normal View History

"""Legacy-compatible config used by older utility modules."""
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
# Keep legacy settings aligned with the root-level env loading rules.
ROOT_DIR = Path(__file__).resolve().parents[3]
ROOT_ENV_FILES = tuple(str(path) for path in (ROOT_DIR / ".env", ROOT_DIR / ".env.development"))
2026-05-14 15:07:34 +08:00
class Settings(BaseSettings):
# DashScope API
"""Define configuration for settings."""
model_config = SettingsConfigDict(
env_file=ROOT_ENV_FILES,
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore",
)
2026-05-14 15:07:34 +08:00
dashscope_api_key: str = ""
# Milvus
milvus_host: str = "6.86.80.8"
2026-05-14 15:07:34 +08:00
milvus_port: int = 19530
milvus_collection: str = "regulations_dense_1024_v2"
2026-05-14 15:07:34 +08:00
# LLM / embedding defaults aligned with the migrated backend path.
2026-05-14 15:07:34 +08:00
llm_model: str = "qwen-max"
embedding_model: str = "text-embedding-v3"
embedding_dim: int = 1024
2026-05-14 15:07:34 +08:00
# Legacy workflow compatibility only.
2026-05-14 15:07:34 +08:00
vector_top_k: int = 10
final_top_k: int = 5
# Legacy local chunking compatibility only; main ingest now uses Aliyun vector_chunks.
2026-05-14 15:07:34 +08:00
chunk_size: int = 800
chunk_overlap: int = 50
# Service config.
2026-05-14 15:07:34 +08:00
api_host: str = "0.0.0.0"
api_port: int = 8000
# Legacy aliases retained for old utility modules.
regulations_collection: str = "regulations_dense_1024_v2"
2026-05-14 15:07:34 +08:00
compliance_collection: str = "compliance_cache"
# Preserve the legacy module API while keeping env resolution centralized at the repo root.
settings = Settings()