mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: approved tool results are lost and approved tools can run twice (#31502)
With tool approval set to ask, the result of an approved tool call was dropped from the chat once the reply finished, so the model no longer saw it in later turns. When the model then asked for a second tool, the first call went back to waiting for approval, and approving it again ran the tool a second time. Approved results now stay in the chat and each tool runs once. Related to #31499
This commit is contained in:
parent
8667dd7121
commit
b00745c8d0
1 changed files with 2 additions and 1 deletions
|
|
@ -1644,7 +1644,8 @@ async def chat_completion(
|
|||
async def process_chat(request, form_data, user, metadata, model, tasks=None):
|
||||
try:
|
||||
ctx = None
|
||||
if metadata.get('assistant_message_id'):
|
||||
# Saved chats load the message after approved tool calls run, so their results are kept
|
||||
if metadata.get('assistant_message_id') and not is_saved_chat_id(metadata.get('chat_id')):
|
||||
ctx = await build_chat_response_context(request, form_data, user, model, metadata, tasks, [])
|
||||
form_data, metadata, events = await process_chat_payload(request, form_data, user, metadata, model)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue