diff --git a/autogpts/autogpt/autogpt/agents/agent.py b/autogpts/autogpt/autogpt/agents/agent.py index 633c3e62..13275a4e 100644 --- a/autogpts/autogpt/autogpt/agents/agent.py +++ b/autogpts/autogpt/autogpt/agents/agent.py @@ -187,13 +187,14 @@ class Agent( NEXT_ACTION_FILE_NAME, ) - self.event_history.register_action( - Action( - name=command_name, - args=arguments, - reasoning=assistant_reply_dict["thoughts"]["reasoning"], + if command_name: + self.event_history.register_action( + Action( + name=command_name, + args=arguments, + reasoning=assistant_reply_dict["thoughts"]["reasoning"], + ) ) - ) return command_name, arguments, assistant_reply_dict diff --git a/autogpts/autogpt/autogpt/app/agent_protocol_server.py b/autogpts/autogpt/autogpt/app/agent_protocol_server.py index 84573edc..1426178f 100644 --- a/autogpts/autogpt/autogpt/app/agent_protocol_server.py +++ b/autogpts/autogpt/autogpt/app/agent_protocol_server.py @@ -226,6 +226,8 @@ class AgentProtocolServer: if execute_command == ask_user.__name__: # HACK execute_result = ActionSuccessResult(outputs=user_input) agent.event_history.register_result(execute_result) + elif not execute_command: + execute_result = None elif execute_approved: step = await self.db.update_step( task_id=task_id, diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.py index c974ae15..ff454e4d 100644 --- a/autogpts/autogpt/autogpt/app/main.py +++ b/autogpts/autogpt/autogpt/app/main.py @@ -556,14 +556,17 @@ async def run_interaction_loop( handle_stop_signal() - result = await agent.execute(command_name, command_args, user_input) + if command_name: + result = await agent.execute(command_name, command_args, user_input) - if result.status == "success": - logger.info(result, extra={"title": "SYSTEM:", "title_color": Fore.YELLOW}) - elif result.status == "error": - logger.warn( - f"Command {command_name} returned an error: {result.error or result.reason}" - ) + if result.status == "success": + logger.info( + result, extra={"title": "SYSTEM:", "title_color": Fore.YELLOW} + ) + elif result.status == "error": + logger.warn( + f"Command {command_name} returned an error: {result.error or result.reason}" + ) def update_user(