mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-09 03:18:18 +00:00
fix: reply never finishes when streaming is off and the model calls a tool (#32083)
With Stream Chat Response turned off, a reply where the model called a tool was never saved or marked as finished, so the chat kept showing it as still generating until the page was reloaded. The reply is now saved and finished like any other non-streamed reply. Tools themselves still only run with streaming on, as the docs describe.
This commit is contained in:
parent
93fc3fcb72
commit
b687225123
1 changed files with 5 additions and 3 deletions
|
|
@ -4179,12 +4179,14 @@ async def non_streaming_chat_response_handler(response, ctx):
|
|||
|
||||
choices = response_data.get('choices', [])
|
||||
response_output = response_data.get('output')
|
||||
content = choices[0].get('message', {}).get('content') if choices else ''
|
||||
content = (choices[0].get('message', {}).get('content') or '') if choices else ''
|
||||
# Native tools only run on the streaming path; still finish the turn.
|
||||
tool_calls = choices[0].get('message', {}).get('tool_calls') if choices else None
|
||||
|
||||
if (continuing and 'error' not in response_data) or (
|
||||
not continuing and choices and (content or response_output)
|
||||
not continuing and choices and (content or response_output or tool_calls)
|
||||
):
|
||||
if content or response_output or continuing:
|
||||
if content or response_output or tool_calls or continuing:
|
||||
if not continuing:
|
||||
await event_emitter(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue