feat/enh: tool server function name filter list
This commit is contained in:
@@ -34,6 +34,7 @@ from langchain_core.utils.function_calling import (
|
||||
)
|
||||
|
||||
|
||||
from open_webui.utils.misc import is_string_allowed
|
||||
from open_webui.models.tools import Tools
|
||||
from open_webui.models.users import UserModel
|
||||
from open_webui.utils.plugin import load_tool_module_by_id
|
||||
@@ -149,8 +150,20 @@ async def get_tools(
|
||||
)
|
||||
|
||||
specs = tool_server_data.get("specs", [])
|
||||
function_name_filter_list = tool_server_connection.get(
|
||||
"function_name_filter_list", None
|
||||
)
|
||||
|
||||
for spec in specs:
|
||||
function_name = spec["name"]
|
||||
if function_name_filter_list and isinstance(
|
||||
function_name_filter_list, list
|
||||
):
|
||||
if not is_string_allowed(
|
||||
function_name, function_name_filter_list
|
||||
):
|
||||
# Skip this function
|
||||
continue
|
||||
|
||||
auth_type = tool_server_connection.get("auth_type", "bearer")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user