update
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""Local assistant entry point without schedulers, business DB or shared AI memory."""
|
||||
from fastapi import FastAPI
|
||||
from contextlib import asynccontextmanager
|
||||
from importlib.util import find_spec
|
||||
|
||||
from app.core.config import get_settings
|
||||
from app.core.http.middleware import request_id_middleware
|
||||
from app.modules.work_assistant.routes import router
|
||||
|
||||
|
||||
def create_assistant_app() -> FastAPI:
|
||||
@asynccontextmanager
|
||||
async def lifespan(app):
|
||||
yield
|
||||
from app.modules.work_assistant.model_gateway import close_model_client
|
||||
close_model_client()
|
||||
|
||||
app = FastAPI(title="管理系统工作助手", debug=False, lifespan=lifespan)
|
||||
app.middleware("http")(request_id_middleware)
|
||||
prefix = get_settings().api_prefix
|
||||
app.include_router(router, prefix=f"{prefix}/work-assistant")
|
||||
|
||||
@app.get(f"{prefix}/health")
|
||||
def health() -> dict:
|
||||
ready = find_spec("langgraph") is not None
|
||||
return {"status": "ok", "service": "work-assistant", "protocol_versions": [1,2] if ready else [1],
|
||||
"orchestration": "langgraph" if ready else "legacy", "features": {
|
||||
"module_skills": ready, "explicit_turn_intent": ready, "adaptive_evidence_review": ready,
|
||||
"structured_computation":ready}}
|
||||
|
||||
return app
|
||||
|
||||
|
||||
app = create_assistant_app()
|
||||
Reference in New Issue
Block a user