jarvis-cloud / backend /routes /agent_routes.py
Jarvis2345's picture
Squash history — remove all prior commits (secret hygiene, S4)
a31f556
Raw
History Blame Contribute Delete
787 Bytes
from fastapi import APIRouter
from pydantic import BaseModel
router = APIRouter()
class ChatPayload(BaseModel):
text: str
context: dict = {}
class GestureEvent(BaseModel):
gesture: str
confidence: float
timestamp: float
import asyncio
from backend.services.agent_service import chat_with_agent, abort_generation
@router.post("/chat")
async def chat(payload: ChatPayload):
# Fire off chat as a background task so it doesn't block
asyncio.create_task(chat_with_agent(payload.text, payload.context))
return {"status": "ok"}
@router.post("/abort")
async def abort():
abort_generation()
return {"status": "ok"}
@router.post("/gesture_event")
async def gesture_event(g: GestureEvent):
return {"status": "ok"}