WalkXR-AI / src / walkxr_ai / api / main.py
main.py
Raw
from fastapi import FastAPI
from fastapi import WebSocket
from pydantic import BaseModel
from .models import ChatRequest, ChatResponse
from walkxr_ai.agents.small_moments_roleplay_agent import SmallMomentsRoleplayAgent
from dotenv import load_dotenv
load_dotenv()


app = FastAPI()
agent = SmallMomentsRoleplayAgent()


@app.post("/chat", response_model=ChatResponse)
async def chat(req: ChatRequest):
    response = agent.get_response(
        user_input=req.message,
        history=req.history or []
    )
    return response