Spaces:
Sleeping
Sleeping
fix(config): use computed_field for dynamic path resolution
Browse files1234567812 unmodified lines2122232425262728293031# core/config.pyfrom functools import lru_cachefrom pydantic import Fieldfrom pydantic_settings import BaseSettings, SettingsConfigDict12 unmodified linesREPO_ID: str = Field(default="m97j/ke-store", description="Hugging Face repository ID")# 2. Storage Settings (Vector DB & RDBMS)SQLITE_PATH: str = Field(default="{DATA_DIR}/knowledge_base/corpus.sqlite", description="SQLite DB file path")QDRANT_PATH: str = Field(default="{DATA_DIR}/vector_store/qdrant", description="Qdrant local storage path")QDRANT_COLLECTION: str = Field(default="knowledge_base", description="Qdrant collection name")QDRANT_URL: str = Field(default="http://localhost:6333", description="Qdrant server URL (if using client-server mode)")# 3. Model Settings (Embedder & Reranker)EMBEDDER_NAME: str = Field(default="BAAI/bge-m3", description="FlagEmbedding model name")RERANKER_NAME: str = Field(default="BAAI/bge-reranker-v2-m3", description="Cross-Encoder model name")12345678912 unmodified lines222324252627282930313233343536373839404142434445464748# core/config.pyimport osfrom functools import lru_cachefrom pydantic import Field, computed_fieldfrom pydantic_settings import BaseSettings, SettingsConfigDict12 unmodified linesREPO_ID: str = Field(default="m97j/ke-store", description="Hugging Face repository ID")# 2. Storage Settings (Vector DB & RDBMS)QDRANT_COLLECTION: str = Field(default="knowledge_base", description="Qdrant collection name")QDRANT_URL: str = Field(default="http://localhost:6333", description="Qdrant server URL (if using client-server mode)")@computed_field@propertydef SQLITE_PATH(self) -> str:"""Computed property to ensure that the SQLite path is always correctly resolved based on the DATA_DIR.This allows dynamic changes to DATA_DIR without breaking the SQLITE_PATH reference."""return os.path.join(self.DATA_DIR, "knowledge_base/corpus.sqlite")@computed_field@propertydef QDRANT_PATH(self) -> str:"""Computed property to ensure that the Qdrant path is always correctly resolved based on the DATA_DIR.This allows dynamic changes to DATA_DIR without breaking the QDRANT_PATH reference."""return os.path.join(self.DATA_DIR, "vector_store/qdrant")# 3. Model Settings (Embedder & Reranker)EMBEDDER_NAME: str = Field(default="BAAI/bge-m3", description="FlagEmbedding model name")RERANKER_NAME: str = Field(default="BAAI/bge-reranker-v2-m3", description="Cross-Encoder model name")
core/config.py+20-3