chat

Chat Stream

Stream AI answer via Server-Sent Events (SSE). Same as POST /chat but with real-time token streaming.

SSE 流式发送消息并获取 AI 回答.

Holds no request-scoped DB session. The endpoint takes neither Depends(get_db) nor Depends(get_optional_user) — the latter carries its own get_db yield-dependency, which FastAPI keeps checked out until the StreamingResponse body is fully sent, i.e. the entire 60-120s LLM window, pinning a PG connection per active stream (project_fojin_db_pool_streaming). Instead the raw bearer token is read off the request and the user is resolved INSIDE the generator's short-lived prep session. The generator owns two short-lived sessions (prep + save) and holds none across the LLM I/O.

post/api/chat/stream

Request

  • Base URL: https://fojin.app (the document declares no server; this is the origin it was published from)
  • URL: https://fojin.app/api/chat/stream
  • Auth: none declared

Request body

messagestring required
session_idinteger nullable
master_idstring nullable
text_idinteger nullable
juan_numinteger nullable
selected_textstring nullable
page_contentstring nullable
hot_question_idinteger nullable
regenerateboolean
model_idstring nullable
attachment_idsinteger[] nullable

Response

Successful Response

unknown required

Changes

No recorded changes to this operation across all 1 revision of this API.