aura / app.py
lordsnow21's picture
Create app.py
c8f4eef verified
raw
history blame contribute delete
562 Bytes
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from model import generate_response
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)
class ChatRequest(BaseModel):
message: str
history: list[str] = []
@app.get("/")
def health():
return {"status": "ok"}
@app.post("/chat")
def chat(req: ChatRequest):
reply = generate_response(req.message)
return {"reply": reply}