From 2b7dd6e39999a5b2aaa45d095638a1231edf796d Mon Sep 17 00:00:00 2001 From: landerrosette <57791410+landerrosette@users.noreply.github.com> Date: Wed, 2 Apr 2025 02:58:02 +0800 Subject: [PATCH] refactor: standardize filter valve retrieval logic --- backend/open_webui/utils/filter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/filter.py b/backend/open_webui/utils/filter.py index a11aeb092..76c9db9eb 100644 --- a/backend/open_webui/utils/filter.py +++ b/backend/open_webui/utils/filter.py @@ -12,9 +12,9 @@ log.setLevel(SRC_LOG_LEVELS["MAIN"]) def get_sorted_filter_ids(model: dict): def get_priority(function_id): function = Functions.get_function_by_id(function_id) - if function is not None and hasattr(function, "valves"): - # TODO: Fix FunctionModel to include vavles - return (function.valves if function.valves else {}).get("priority", 0) + if function is not None: + valves = Functions.get_function_valves_by_id(function_id) + return valves.get("priority", 0) if valves else 0 return 0 filter_ids = [function.id for function in Functions.get_global_filter_functions()]