Fix SSE route dependency and align architecture docs
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
"""Initialize the app.core package."""
|
||||
|
||||
from .config import settings, Settings
|
||||
# Keep package boundaries explicit so backend imports stay predictable.
|
||||
|
||||
|
||||
__all__ = ["settings", "Settings"]
|
||||
@@ -1,41 +1,54 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
"""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 = "localhost"
|
||||
milvus_port: int = 19530
|
||||
milvus_collection: str = "regulations_dense_1536"
|
||||
|
||||
# LLM配置
|
||||
# LLM / embedding defaults aligned with the migrated backend path.
|
||||
llm_model: str = "qwen-max"
|
||||
embedding_model: str = "text-embedding-v3"
|
||||
embedding_dim: int = 1536
|
||||
|
||||
# 检索配置
|
||||
# Legacy workflow compatibility only.
|
||||
vector_top_k: int = 10
|
||||
bm25_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
|
||||
|
||||
# Collection名称
|
||||
regulations_collection: str = "vehicle_regulations"
|
||||
# Legacy aliases retained for old utility modules.
|
||||
regulations_collection: str = "regulations_dense_1536"
|
||||
compliance_collection: str = "compliance_cache"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
case_sensitive = False
|
||||
|
||||
|
||||
settings = Settings()
|
||||
# Preserve the legacy module API while keeping env resolution centralized at the repo root.
|
||||
settings = Settings()
|
||||
|
||||
Reference in New Issue
Block a user