mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-18 04:43:55 +00:00
fix: built-in tools disappear when a model has a custom tools parameter (#32530)
Adding a custom parameter named tools to a model, for example to turn on a provider's native web search, made Open WebUI drop all of its own tools for that model: notes, knowledge, tasks and any tools attached to the model stopped working, and attached files lost their context. Those tools now stay, and the model's custom tools are sent alongside them. API calls that pass their own tools, or an empty list to turn tools off, behave as before. Fixes #32528
This commit is contained in:
parent
0dd18050a6
commit
3ccea416b4
1 changed files with 1 additions and 1 deletions
|
|
@ -2059,6 +2059,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
# Keep the template before apply_params_to_form_data consumes the model parameters.
|
||||
model_system_prompt_template = (form_data.get('params') or {}).get('system')
|
||||
|
||||
payload_tools = form_data.get('tools', None) # snapshot before filters
|
||||
form_data = apply_params_to_form_data(form_data, model)
|
||||
log.debug('form_data: %s', form_data)
|
||||
|
||||
|
|
@ -2070,7 +2071,6 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
chat_id = metadata.get('chat_id')
|
||||
user_message_id = metadata.get('user_message_id')
|
||||
pending_assistant_message = None
|
||||
payload_tools = form_data.get('tools', None) # snapshot before filters
|
||||
chat = await Chats.get_chat_by_id(chat_id) if is_saved_chat_id(chat_id) else None
|
||||
is_note_chat = bool(chat and (chat.meta or {}).get('internal') is True and (chat.meta or {}).get('type') == 'note')
|
||||
use_builtin_tools = is_note_chat or (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue