Files
AIRegulation-DocAnalysis/backend/app/core/config.py
ash66 30c7bda389 Refactor document handling and update Milvus collection settings
- Removed multiple failed document entries from `documents.json`.
- Added a new document entry with updated metadata and changed the index name to `regulations_dense_1024_v2`.
- Updated architecture documentation to reflect changes in the Milvus collection name.
- Adjusted requirements by removing the sqlalchemy dependency.
- Modified test cases to align with new document structure and naming conventions.
- Introduced a new test file for Milvus vector index runtime recovery and error handling.
- Updated assertions in various test files to ensure compatibility with the new schema.
2026-05-26 20:21:31 +08:00

55 lines
1.5 KiB
Python

"""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"))
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",
)
dashscope_api_key: str = ""
# Milvus
milvus_host: str = "6.86.80.8"
milvus_port: int = 19530
milvus_collection: str = "regulations_dense_1024_v2"
# LLM / embedding defaults aligned with the migrated backend path.
llm_model: str = "qwen-max"
embedding_model: str = "text-embedding-v3"
embedding_dim: int = 1024
# Legacy workflow compatibility only.
vector_top_k: int = 10
final_top_k: int = 5
# Legacy local chunking compatibility only; main ingest now uses Aliyun vector_chunks.
chunk_size: int = 800
chunk_overlap: int = 50
# Service config.
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"
compliance_collection: str = "compliance_cache"
# Preserve the legacy module API while keeping env resolution centralized at the repo root.
settings = Settings()