mirror of
https://github.com/open-webui/open-webui
synced 2025-06-16 19:31:52 +00:00
fix: Correctly handle toggle filters to prevent unintended activation
This commit is contained in:
parent
8598fc9608
commit
332043c38b
@ -36,15 +36,17 @@ def get_sorted_filter_ids(request, model: dict, enabled_filter_ids: list = None)
|
|||||||
function.id
|
function.id
|
||||||
for function in Functions.get_functions_by_type("filter", active_only=True)
|
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)
|
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 (
|
active_filter_ids = [
|
||||||
filter_id not in enabled_filter_ids
|
filter_id for filter_id in active_filter_ids
|
||||||
):
|
if should_keep_filter(filter_id)
|
||||||
active_filter_ids.remove(filter_id)
|
]
|
||||||
continue
|
|
||||||
|
|
||||||
filter_ids = [fid for fid in filter_ids if fid in active_filter_ids]
|
filter_ids = [fid for fid in filter_ids if fid in active_filter_ids]
|
||||||
filter_ids.sort(key=get_priority)
|
filter_ids.sort(key=get_priority)
|
||||||
|
Loading…
Reference in New Issue
Block a user