File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -896,20 +896,15 @@ async def async_respond(self, user_input=None):
896896 output = result .error
897897 else :
898898 output = result .output
899- self .messages .append (
900- {
901- "role" : "tool" ,
902- "content" : output ,
903- "tool_call_id" : tool_call .id ,
904- }
905- )
899+
900+ tool_output = ""
901+
902+ if output :
903+ tool_output += output
904+
906905 if result .base64_image :
907- self .messages .append (
908- {
909- "role" : "tool" ,
910- "content" : "The user will reply with the tool's image output." ,
911- "tool_call_id" : tool_call .id ,
912- }
906+ tool_output += (
907+ "\n The user will reply with the tool's image output."
913908 )
914909 user_content_to_add .append (
915910 {
@@ -919,6 +914,17 @@ async def async_respond(self, user_input=None):
919914 },
920915 }
921916 )
917+
918+ if tool_output == "" :
919+ tool_output = "No output from tool."
920+
921+ self .messages .append (
922+ {
923+ "role" : "tool" ,
924+ "content" : tool_output .strip (),
925+ "tool_call_id" : tool_call .id ,
926+ }
927+ )
922928 else :
923929 text_content = (
924930 "This was the output of the tool call. What does it mean/what's next?\n "
You can’t perform that action at this time.
0 commit comments