This commit is contained in:
32
rag_indexer/config.py
Normal file
32
rag_indexer/config.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
RAG Indexer 配置管理模块
|
||||
集中管理所有环境变量配置项,避免散落在各个文件中
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# 尝试从 rag_core 导入配置(如果可用)
|
||||
try:
|
||||
from rag_core.config import (
|
||||
QDRANT_URL,
|
||||
QDRANT_API_KEY,
|
||||
LLAMACPP_EMBEDDING_URL,
|
||||
LLAMACPP_API_KEY,
|
||||
DB_URI,
|
||||
DOCSTORE_URI,
|
||||
)
|
||||
except ImportError:
|
||||
# 如果 rag_core 不可用,则直接读取环境变量
|
||||
QDRANT_URL = os.getenv("QDRANT_URL", "http://127.0.0.1:6333")
|
||||
QDRANT_API_KEY = os.getenv("QDRANT_API_KEY", "")
|
||||
LLAMACPP_EMBEDDING_URL = os.getenv("LLAMACPP_EMBEDDING_URL", "http://127.0.0.1:8082")
|
||||
LLAMACPP_API_KEY = os.getenv("LLAMACPP_API_KEY", "")
|
||||
DB_URI = os.getenv(
|
||||
"DB_URI",
|
||||
"postgresql://postgres:huang1998@ai-postgres:5432/langgraph_db?sslmode=disable"
|
||||
)
|
||||
DOCSTORE_URI = os.getenv("DOCSTORE_URI", DB_URI)
|
||||
|
||||
# ========== 索引器专用配置 ==========
|
||||
# 默认索引存储路径
|
||||
INDEX_STORAGE_PATH = os.getenv("INDEX_STORAGE_PATH", "./index_storage")
|
||||
Reference in New Issue
Block a user