mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-05 07:57:06 +00:00
fix: pair each round's tool results with that round's tool calls
Closes #28305
This commit is contained in:
parent
5caa91a493
commit
587a55f33b
1 changed files with 7 additions and 0 deletions
|
|
@ -4918,6 +4918,13 @@ async def streaming_chat_response_handler(response, ctx):
|
|||
|
||||
response_tool_calls = tool_calls.pop(0)
|
||||
|
||||
answered_call_ids = {
|
||||
item.get('call_id') for item in output if item.get('type') == 'function_call_output'
|
||||
}
|
||||
for tc in response_tool_calls:
|
||||
if tc.get('id') and tc['id'] in answered_call_ids:
|
||||
tc['id'] = output_id('call')
|
||||
|
||||
# Append function_call items for each tool call
|
||||
# (Responses API already has them from streaming, so skip duplicates)
|
||||
existing_call_ids = {item.get('call_id') for item in output if item.get('type') == 'function_call'}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue