π OpenHands: AI-Driven Development
fix: handle the case where LLM assistant return None instead of empty string (#4690)
Xingyao Wangadf7ab584935
diff --git a/openhands/agenthub/codeact_agent/codeact_agent.py b/openhands/agenthub/codeact_agent/codeact_agent.pyindex ff0f304c51..2f5eef10c3 100644--- a/openhands/agenthub/codeact_agent/codeact_agent.py+++ b/openhands/agenthub/codeact_agent/codeact_agent.py@@ -185,7 +185,7 @@ class CodeActAgent(Agent):pending_tool_call_action_messages[llm_response.id] = Message(role=assistant_msg.role,# tool call content SHOULD BE a string- content=[TextContent(text=assistant_msg.content)]+ content=[TextContent(text=assistant_msg.content or '')]if assistant_msg.content is not Noneelse [],tool_calls=assistant_msg.tool_calls,@@ -201,7 +201,7 @@ class CodeActAgent(Agent):]elif isinstance(action, MessageAction):role = 'user' if action.source == 'user' else 'assistant'- content = [TextContent(text=action.content)]+ content = [TextContent(text=action.content or '')]if self.llm.vision_is_active() and action.images_urls:content.append(ImageContent(image_urls=action.images_urls))return [