feat(bootstrap): refactor runtime dependency management and add lazy loading for binary store and vector index

feat(agent): update import for agent session service
feat(openai): add context truncation check in OpenAI answer generator
docs(README): update frontend environment file conventions
fix(vite): default local frontend development to local backend
This commit is contained in:
ash66
2026-05-25 13:58:48 +08:00
parent 091a02c522
commit 10a034e294
11 changed files with 162 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ from app.api.models import ErrorResponse
from app.api.routes import api_router
from app.config.logging import setup_logging
from app.config.settings import settings
from app.services.llm.llm_factory import LLMFactory
from app.shared.bootstrap import cleanup_runtime_dependencies, preload_runtime_dependencies
# Keep module behavior explicit so the backend flow stays easy to audit.
@@ -24,12 +24,12 @@ async def lifespan(app: FastAPI):
logger.info(f"启动 {settings.app_name} v{settings.app_version}")
logger.info(f"调试模式: {settings.debug}")
logger.info("预加载LLM客户端...")
LLMFactory.preload_clients(["qwen", "deepseek"])
preload_runtime_dependencies()
yield
logger.info("应用关闭,执行清理...")
LLMFactory.cleanup()
cleanup_runtime_dependencies()
app = FastAPI(

View File

@@ -20,7 +20,7 @@ from app.api.models import (
)
from app.config.settings import settings
from app.shared.async_utils import iter_in_thread
from app.shared.bootstrap import get_agent_conversation_service, get_conversation_store
from app.shared.bootstrap import get_agent_conversation_service, get_agent_session_service
# Keep route handlers close to their transport-layer wiring for easier auditing.