Загрузить файлы в «/»

This commit is contained in:
dapa46 committed 2025-12-06 14:58:53 +03:00
1 parent b496d672fa
commit 32f57d9a22
1 file changed
+13
+13
View File
@@ -0,0 +1,13 @@
from fastapi import APIRouter, HTTPException
from app.models.schemas import ChatRequest, ChatResponse
from app.services.gigachat import call_gigachat
router = APIRouter()
@router.post("/chat", response_model=ChatResponse)
async def chat_endpoint(payload: ChatRequest):
try:
reply = await call_gigachat(payload.message, payload.agent.value)
return ChatResponse(reply=reply, agent_used=payload.agent.value)
except Exception as exc:
raise HTTPException(status_code=502, detail=f"GigaChat error: {str(exc)}")