SOSSKEEEE!
Build and Push Agent API / build (push) Successful in 5s

This commit is contained in:
2026-05-24 18:27:18 +02:00
parent 1d65c7a9e9
commit 2cd72c7770
4 changed files with 83 additions and 13 deletions
+15 -12
View File
@@ -1,4 +1,5 @@
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
@@ -23,10 +24,22 @@ from agents import load_all_agents # noqa: E402
load_all_agents()
# ---------------------------------------------------------------------------
# Lifespan
# ---------------------------------------------------------------------------
@asynccontextmanager
async def lifespan(app: FastAPI):
from bot.discord_bot import start_in_background # noqa: E402
start_in_background()
yield
# ---------------------------------------------------------------------------
# App
# ---------------------------------------------------------------------------
app = FastAPI()
app = FastAPI(lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
@@ -47,14 +60,4 @@ app.state.agent_graphs: dict = {}
# ---------------------------------------------------------------------------
# Routers
# ---------------------------------------------------------------------------
app.include_router(v1_router, prefix="/v1")
# ---------------------------------------------------------------------------
# Discord bot — launched once on app startup (not at import time, which
# would double-fire under uvicorn --reload).
# ---------------------------------------------------------------------------
@app.on_event("startup")
async def _start_discord_bot() -> None:
from bot.discord_bot import start_in_background # noqa: E402
start_in_background()
app.include_router(v1_router, prefix="/v1")