mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 13:55:19 +00:00
refactor: standardize filter valve retrieval logic
This commit is contained in:
parent
04799f1f95
commit
2b7dd6e399
1 changed files with 3 additions and 3 deletions
|
|
@ -12,9 +12,9 @@ log.setLevel(SRC_LOG_LEVELS["MAIN"])
|
||||||
def get_sorted_filter_ids(model: dict):
|
def get_sorted_filter_ids(model: dict):
|
||||||
def get_priority(function_id):
|
def get_priority(function_id):
|
||||||
function = Functions.get_function_by_id(function_id)
|
function = Functions.get_function_by_id(function_id)
|
||||||
if function is not None and hasattr(function, "valves"):
|
if function is not None:
|
||||||
# TODO: Fix FunctionModel to include vavles
|
valves = Functions.get_function_valves_by_id(function_id)
|
||||||
return (function.valves if function.valves else {}).get("priority", 0)
|
return valves.get("priority", 0) if valves else 0
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
filter_ids = [function.id for function in Functions.get_global_filter_functions()]
|
filter_ids = [function.id for function in Functions.get_global_filter_functions()]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue