mirror of
https://github.com/open-webui/open-webui.git
synced 2026-04-30 01:10:17 -05:00
refac
This commit is contained in:
@@ -1186,7 +1186,7 @@ async def get_tool_servers_data(servers: List[Dict[str, Any]]) -> List[Dict[str,
|
|||||||
{
|
{
|
||||||
"id": str(id),
|
"id": str(id),
|
||||||
"idx": idx,
|
"idx": idx,
|
||||||
"url": server.get("url"),
|
"url": (server.get("url") or "").rstrip("/"),
|
||||||
"openapi": openapi_data,
|
"openapi": openapi_data,
|
||||||
"info": response.get("info"),
|
"info": response.get("info"),
|
||||||
"specs": response.get("specs"),
|
"specs": response.get("specs"),
|
||||||
@@ -1250,7 +1250,7 @@ async def execute_tool_server(
|
|||||||
if params[param_name] is not None:
|
if params[param_name] is not None:
|
||||||
query_params[param_name] = params[param_name]
|
query_params[param_name] = params[param_name]
|
||||||
|
|
||||||
final_url = f"{url}{route_path}"
|
final_url = f"{url.rstrip('/')}{route_path}"
|
||||||
for key, value in path_params.items():
|
for key, value in path_params.items():
|
||||||
final_url = final_url.replace(f"{{{key}}}", str(value))
|
final_url = final_url.replace(f"{{{key}}}", str(value))
|
||||||
|
|
||||||
@@ -1320,6 +1320,8 @@ def get_tool_server_url(url: Optional[str], path: str) -> str:
|
|||||||
if "://" in path:
|
if "://" in path:
|
||||||
# If it contains "://", it's a full URL
|
# If it contains "://", it's a full URL
|
||||||
return path
|
return path
|
||||||
|
if url:
|
||||||
|
url = url.rstrip("/")
|
||||||
if not path.startswith("/"):
|
if not path.startswith("/"):
|
||||||
# Ensure the path starts with a slash
|
# Ensure the path starts with a slash
|
||||||
path = f"/{path}"
|
path = f"/{path}"
|
||||||
|
|||||||
Reference in New Issue
Block a user