mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 20:59:56 -05:00
ai: keep slow-CPU chat streams alive
On the FX-8320 the first token took over a minute, and Sanic's default 60-second RESPONSE_TIMEOUT killed the stream before anything was sent. Raise the timeout above the chat loop's own 600s hard ceiling, and emit a status event before every model call so the stream is never silent — for proxies and for the user staring at a slow machine. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3715c1a45a
commit
3d8ae44fed
3 changed files with 9 additions and 2 deletions
|
|
@ -152,6 +152,9 @@ async def post_chat(request: Request, body: ChatRequest):
|
|||
return
|
||||
|
||||
service.record_llm_activity()
|
||||
# Always send something before the model call: on slow CPUs the first token can be
|
||||
# minutes away, and a silent stream looks dead to the UI and to proxies.
|
||||
await _send_event(response, 'status', dict(message='Thinking…'))
|
||||
tool_calls = []
|
||||
final_answer = []
|
||||
async for event in llama_chat_stream(messages, tools):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue