Explorar el Código

refactor(tool-engine): Optimize tool engine response handling (#14216)

Co-authored-by: xudong2.zhang <xudong2.zhang@zkh.com>
Co-authored-by: crazywoola <427733928@qq.com>
Zhang Xudong hace 1 mes
padre
commit
ce545274a6
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4 3
      api/core/tools/tool_engine.py

+ 4 - 3
api/core/tools/tool_engine.py

@@ -246,10 +246,11 @@ class ToolEngine:
                     + "you do not need to create it, just tell the user to check it now."
                 )
             elif response.type == ToolInvokeMessage.MessageType.JSON:
-                text = json.dumps(cast(ToolInvokeMessage.JsonMessage, response.message).json_object, ensure_ascii=False)
-                result += f"tool response: {text}."
+                result = json.dumps(
+                    cast(ToolInvokeMessage.JsonMessage, response.message).json_object, ensure_ascii=False
+                )
             else:
-                result += f"tool response: {response.message!r}."
+                result += str(response.message)
 
         return result