MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / _build_streaming_chat_response

Function _build_streaming_chat_response

astrbot/dashboard/api/open_api.py:67–85  ·  view source on GitHub ↗
(
    chat_service: ChatService,
    username: str,
    post_data: dict[str, Any],
)

Source from the content-addressed store, hash-verified

65
66
67async def _build_streaming_chat_response(
68 chat_service: ChatService,
69 username: str,
70 post_data: dict[str, Any],
71) -> StreamingResponse | JSONResponse:
72 try:
73 stream = await chat_service.build_chat_stream(username, post_data)
74 except ChatServiceError as exc:
75 return _open_api_error(str(exc))
76
77 return StreamingResponse(
78 stream,
79 media_type="text/event-stream",
80 headers={
81 "Cache-Control": "no-cache",
82 "Transfer-Encoding": "chunked",
83 "Connection": "keep-alive",
84 },
85 )
86
87
88async def _open_api_chat_response(

Callers 1

_open_api_chat_responseFunction · 0.85

Calls 2

_open_api_errorFunction · 0.85
build_chat_streamMethod · 0.80

Tested by

no test coverage detected