mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
17 lines
466 B
Python
17 lines
466 B
Python
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends, Form
|
|
from fastapi.responses import StreamingResponse
|
|
from rotoger import AppStructLogger
|
|
|
|
from app.services.llm import get_llm_service
|
|
|
|
logger = AppStructLogger().get_logger()
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.post("/chat/")
|
|
async def chat(prompt: Annotated[str, Form()], llm_service=Depends(get_llm_service)):
|
|
return StreamingResponse(llm_service.stream_chat(prompt), media_type="text/plain")
|