mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 20:35:19 +00:00
fix: Correctly handle toggle filters to prevent unintended activation
This commit is contained in:
parent
8598fc9608
commit
332043c38b
1 changed files with 9 additions and 7 deletions
|
|
@ -36,15 +36,17 @@ def get_sorted_filter_ids(request, model: dict, enabled_filter_ids: list = None)
|
|||
function.id
|
||||
for function in Functions.get_functions_by_type("filter", active_only=True)
|
||||
]
|
||||
|
||||
for filter_id in active_filter_ids:
|
||||
|
||||
def should_keep_filter(filter_id):
|
||||
function_module = get_function_module(request, filter_id)
|
||||
|
||||
return not (getattr(function_module, "toggle", None) and
|
||||
filter_id not in (enabled_filter_ids or []))
|
||||
|
||||
if getattr(function_module, "toggle", None) and (
|
||||
filter_id not in enabled_filter_ids
|
||||
):
|
||||
active_filter_ids.remove(filter_id)
|
||||
continue
|
||||
active_filter_ids = [
|
||||
filter_id for filter_id in active_filter_ids
|
||||
if should_keep_filter(filter_id)
|
||||
]
|
||||
|
||||
filter_ids = [fid for fid in filter_ids if fid in active_filter_ids]
|
||||
filter_ids.sort(key=get_priority)
|
||||
|
|
|
|||
Loading…
Reference in a new issue