16 lines
359 B
Python
16 lines
359 B
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from src.api.external import router as ws_router
|
|
from src.agent import AgentService
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
AgentService() # инициализируем синглтон
|
|
yield
|
|
|
|
|
|
app = FastAPI(lifespan=lifespan)
|
|
app.include_router(ws_router)
|