[changes] Batch mode for metadata creation and unified management of indexes

This commit is contained in:
lanceyq
2026-03-16 23:06:41 +08:00
parent 8e6288bca8
commit 56adca9f22
6 changed files with 156 additions and 333 deletions

View File

@@ -18,7 +18,6 @@ from app.core.logging_config import LoggingConfig, get_logger
from app.core.response_utils import fail
from app.core.models.scripts.loader import load_models
from app.db import get_db_context
from app.repositories.neo4j.index_manager import ensure_indexes
# Initialize logging system
LoggingConfig.setup_logging()
@@ -62,16 +61,6 @@ async def lifespan(app: FastAPI):
else:
logger.info("预定义模型加载已禁用 (LOAD_MODEL=false)")
# 确保 Neo4j 索引存在(幂等,多环境安全)
try:
report = await ensure_indexes()
if report["errors"]:
logger.warning(f"Neo4j 索引部分创建失败: {report['errors']}")
else:
logger.info(f"Neo4j 索引检查完成 [{report['uri']}]")
except Exception as e:
logger.warning(f"Neo4j 索引检查跳过(连接失败): {e}")
logger.info("应用程序启动完成")
yield
logger.info("应用程序正在关闭")