llm-chatbot/app/main.py
2025-09-14 17:15:48 +00:00

18 lines
484 B
Python

from fastapi import FastAPI
from . import database, models, api
from app.api import router as api_router
app = FastAPI()
app.include_router(api_router, prefix="/api")
@app.on_event("startup")
async def startup():
async with database.engine.begin() as conn:
await conn.run_sync(models.Base.metadata.create_all)
@app.get("/{full_path:path}")
async def serve_spa(full_path: str):
index_path = os.path.join(dist_path, "index.html")
return FileResponse(index_path)