2026-05-18 16:32:42 +08:00
|
|
|
"""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
|
2026-05-18 16:32:42 +08:00
|
|
|
"""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
|
2026-05-20 23:34:08 +08:00
|
|
|
milvus_host: str = "6.86.80.8"
|
2026-05-14 15:07:34 +08:00
|
|
|
milvus_port: int = 19530
|
2026-05-18 22:30:28 +08:00
|
|
|
milvus_collection: str = "regulations_dense_1024_v1"
|
2026-05-14 15:07:34 +08:00
|
|
|
|
2026-05-18 16:32:42 +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"
|
2026-05-18 22:30:28 +08:00
|
|
|
embedding_dim: int = 1024
|
2026-05-14 15:07:34 +08:00
|
|
|
|
2026-05-18 16:32:42 +08:00
|
|
|
# Legacy workflow compatibility only.
|
2026-05-14 15:07:34 +08:00
|
|
|
vector_top_k: int = 10
|
|
|
|
|
final_top_k: int = 5
|
|
|
|
|
|
2026-05-18 16:32:42 +08:00
|
|
|
# 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
|
|
|
|
|
|
2026-05-18 16:32:42 +08:00
|
|
|
# Service config.
|
2026-05-14 15:07:34 +08:00
|
|
|
api_host: str = "0.0.0.0"
|
|
|
|
|
api_port: int = 8000
|
|
|
|
|
|
2026-05-18 16:32:42 +08:00
|
|
|
# Legacy aliases retained for old utility modules.
|
2026-05-18 22:30:28 +08:00
|
|
|
regulations_collection: str = "regulations_dense_1024_v1"
|
2026-05-14 15:07:34 +08:00
|
|
|
compliance_collection: str = "compliance_cache"
|
|
|
|
|
|
2026-05-18 16:32:42 +08:00
|
|
|
# Preserve the legacy module API while keeping env resolution centralized at the repo root.
|
|
|
|
|
settings = Settings()
|