Преглед изворни кода

refac/fix: support delete method for openapi tool servers

Timothy Jaeryang Baek пре 4 месеци
родитељ
комит
8039cc40f7
2 измењених фајлова са 5 додато и 2 уклоњено
  1. 1 1
      backend/open_webui/utils/tools.py
  2. 4 1
      src/lib/apis/index.ts

+ 1 - 1
backend/open_webui/utils/tools.py

@@ -754,7 +754,7 @@ async def execute_tool_server(
         ) as session:
             request_method = getattr(session, http_method.lower())
 
-            if http_method in ["post", "put", "patch"]:
+            if http_method in ["post", "put", "patch", "delete"]:
                 async with request_method(
                     final_url,
                     json=body_params,

+ 4 - 1
src/lib/apis/index.ts

@@ -494,7 +494,10 @@ export const executeToolServer = async (
 			headers
 		};
 
-		if (['post', 'put', 'patch'].includes(httpMethod.toLowerCase()) && operation.requestBody) {
+		if (
+			['post', 'put', 'patch', 'delete'].includes(httpMethod.toLowerCase()) &&
+			operation.requestBody
+		) {
 			requestOptions.body = JSON.stringify(bodyParams);
 		}