27 lines
935 B
Python
27 lines
935 B
Python
from fastapi import FastAPI, Request
|
||
from fastapi.staticfiles import StaticFiles
|
||
from fastapi.templating import Jinja2Templates
|
||
|
||
from app.api import chat
|
||
from app.models.schemas import AgentOption
|
||
|
||
app = FastAPI(title="SwarmMind – Multi-Agent Chat")
|
||
|
||
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
||
templates = Jinja2Templates(directory="app/templates")
|
||
|
||
# ------------------------------------------------------------------ #
|
||
# UI
|
||
# ------------------------------------------------------------------ #
|
||
@app.get("/")
|
||
async def root(request: Request):
|
||
agents = [opt.value for opt in AgentOption]
|
||
return templates.TemplateResponse(
|
||
"index.html",
|
||
{"request": request, "agents": agents},
|
||
)
|
||
|
||
# ------------------------------------------------------------------ #
|
||
# API
|
||
# ------------------------------------------------------------------ #
|
||
app.include_router(chat.router, prefix="/api") |