Timothy Jaeryang Baek há 1 semana atrás
pai
commit
4997ef2662
1 ficheiros alterados com 17 adições e 0 exclusões
  1. 17 0
      backend/open_webui/utils/middleware.py

+ 17 - 0
backend/open_webui/utils/middleware.py

@@ -304,6 +304,13 @@ async def chat_completion_tools_handler(
                 ):
                     tool_result, tool_response_headers = tool_result
 
+                    try:
+                        if not isinstance(tool_response_headers, dict):
+                            tool_response_headers = dict(tool_response_headers)
+                    except Exception as e:
+                        tool_response_headers = {}
+                        log.debug(e)
+
                     if tool_response_headers and isinstance(
                         tool_response_headers, dict
                     ):
@@ -2634,6 +2641,16 @@ async def process_chat_response(
                         ):
                             tool_result, tool_response_headers = tool_result
 
+                            try:
+                                if not isinstance(tool_response_headers, dict):
+                                    tool_response_headers = dict(tool_response_headers)
+                            except Exception as e:
+                                tool_response_headers = {}
+                                log.debug(e)
+
+                            print(tool_response_headers)
+                            print(type(tool_response_headers))
+
                             if tool_response_headers and isinstance(
                                 tool_response_headers, dict
                             ):