main.py 502 B

123456789101112131415161718192021
  1. from fastapi import FastAPI
  2. from app.api import health, recommend
  3. app = FastAPI(title="cfc-langgraph", version="0.1.0")
  4. app.include_router(health.router)
  5. app.include_router(recommend.router)
  6. @app.on_event("startup")
  7. async def startup():
  8. from app.rag.retriever import RagRetriever
  9. retriever = RagRetriever()
  10. await retriever.initialize()
  11. @app.on_event("shutdown")
  12. async def shutdown():
  13. from app.tools.java_client import JavaClient
  14. client = JavaClient()
  15. await client.close()