mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-04 10:37:56 -05:00
fix: reply after tools stop can come back empty with some models (#34759)
When a chat hits the tool call limit, or tool use stops because the same call keeps failing or a reply is cut off in the middle of a call, Open WebUI asks the model for one last answer. The instruction to stop and answer was merged into the system prompt at the very top of the conversation, so some models (Gemma 4 on vLLM, for example) kept trying to call tools and returned an empty reply. It is now sent as the last message, after the tool results, so the model reads it right before answering. The start of that last request also stays identical to the earlier ones, so provider prompt caching keeps working for it. Fixes #34750
This commit is contained in:
1 parent
639e25ae39
commit
9475106560
1 file changed
+1
-1
@@ -337,5 +337,5 @@ def final_answer_payload(payload):
|
||||
return {
|
||||
**payload,
|
||||
'tool_choice': 'none',
|
||||
'messages': [*payload.get('messages', []), {'role': 'system', 'content': FINAL_ANSWER_PROMPT}],
|
||||
'messages': [*payload.get('messages', []), {'role': 'user', 'content': FINAL_ANSWER_PROMPT}],
|
||||
}
|
||||
Reference in new issue
Block a user