from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.core.config import CORS_ORIGINS from app.db.database import init_db from app.api import chat, memory app = FastAPI(title="PlayChat API", version="0.1.0") app.add_middleware( CORSMiddleware, allow_origins=CORS_ORIGINS, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.on_event("startup") def on_startup(): init_db() app.include_router(chat.router) app.include_router(memory.router) @app.get("/health") def health(): return {"status": "ok"}