Skip to content

Commit 56dc7c5

Browse files
committed
refac
1 parent e570a98 commit 56dc7c5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

backend/open_webui/utils/middleware.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,8 @@ async def stream_body_handler(response):
19121912
tool_result_files = []
19131913
if isinstance(tool_result, list):
19141914
for item in tool_result:
1915-
if item.startswith("data:"):
1915+
# check if string
1916+
if isinstance(item, str) and item.startswith("data:"):
19161917
tool_result_files.append(item)
19171918
tool_result.remove(item)
19181919

backend/open_webui/utils/tools.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,18 @@ def get_tools(
6969
elif auth_type == "session":
7070
token = request.state.token.credentials
7171

72+
async def tool_function(**args):
73+
return await execute_tool_server(
74+
token=token,
75+
url=tool_server_data["url"],
76+
name=function_name,
77+
params=args,
78+
server_data=tool_server_data,
79+
)
80+
7281
callable = get_async_tool_function_and_apply_extra_params(
73-
execute_tool_server,
74-
{
75-
"token": token,
76-
"url": tool_server_data["url"],
77-
"name": function_name,
78-
"server_data": tool_server_data,
79-
},
82+
tool_function,
83+
{},
8084
)
8185

8286
tool_dict = {

0 commit comments

Comments
 (0)