mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-28 01:31:28 +00:00
fix: clear incompatible tools when switching models
When switching from a model with tools to one without those tools, the previously selected tools remained active. This happened because the settings.tools fallback did not check compatibility with the current model. Now when a model doesn't define toolIds, the global settings tools are only applied if they are compatible with the current model's filters or toolIds. This prevents tools from a previous model from leaking into a model that doesn't support them. Fixes #14157
This commit is contained in:
parent
1860874192
commit
3cb7bee4d7
1 changed files with 6 additions and 1 deletions
|
|
@ -338,7 +338,12 @@
|
|||
selectedToolIds = authed;
|
||||
pendingOAuthTools = unauthed;
|
||||
} else if ($settings?.tools) {
|
||||
selectedToolIds = $settings.tools;
|
||||
// Only apply global tool settings for tools compatible with the current model
|
||||
const modelFilterIds = model?.filters?.map((f) => f.id) ?? [];
|
||||
const modelToolIds = model?.info?.meta?.toolIds ?? [];
|
||||
selectedToolIds = $settings.tools.filter(
|
||||
(id) => modelToolIds.includes(id) || modelFilterIds.includes(id)
|
||||
);
|
||||
} else {
|
||||
selectedToolIds = selectedToolIds.filter((id) => !id.startsWith('direct_server:'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue