mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-04 18:47:56 -05:00
fix: chats fail when a Tether OpenAPI tool has the same name as another tool (#34730)
When two tool servers offer a tool with the same name, Open WebUI puts the server ID in front of the second one so the model can tell them apart. Tool servers added in Tether have IDs with colons, so the renamed tool broke the name rules of OpenAI-compatible providers and the provider rejected the whole chat for an invalid tool name. The same happened for admin tool servers whose ID has a dot. Characters outside letters, digits, underscores and dashes are now replaced with underscores in the renamed tool, and calls still reach the right server. Same cause as #34718, which covered MCP servers from Tether. Fixes #34729
This commit is contained in:
1 parent
4fc317b3d1
commit
45f489bea8
1 file changed
+1
-1
@@ -609,7 +609,7 @@ async def get_tools(request: Request, tool_ids: list[str], user: UserModel, extr
|
||||
while function_name in tools_dict:
|
||||
log.warning(f'Tool {function_name} already exists in another tools!')
|
||||
# Prepend server ID to function name
|
||||
function_name = f'{server_id}_{function_name}'
|
||||
function_name = re.sub(r'[^a-zA-Z0-9_-]', '_', f'{server_id}_{function_name}')
|
||||
|
||||
tool_dict['spec'] = {**tool_dict['spec'], 'name': function_name}
|
||||
tools_dict[function_name] = tool_dict
|
||||
|
||||
Reference in new issue
Block a user