Fixed return values

This commit is contained in:
Zvonimir Sabljic
2023-09-18 18:37:56 -07:00
parent 52e60b1376
commit ab20b7a71c
2 changed files with 12 additions and 6 deletions

View File

@@ -62,7 +62,7 @@ class Developer(Agent):
task_steps = convo_dev_task.send_message('development/parse_task.prompt', {}, IMPLEMENT_TASK)
convo_dev_task.remove_last_x_messages(2)
self.execute_task(convo_dev_task, task_steps, development_task=development_task, continue_development=True, is_root_task=True)
return self.execute_task(convo_dev_task, task_steps, development_task=development_task, continue_development=True, is_root_task=True)
def step_code_change(self, convo, step, i, test_after_code_changes):
if step['type'] == 'code_change' and 'code_change_description' in step:

View File

@@ -109,6 +109,11 @@ def execute_command(project, command, timeout=None, force=False):
'If yes, just press ENTER'
)
if answer == 'no':
return '', 'DONE'
elif answer == 'skip':
return '', 'DONE'
# TODO when a shell built-in commands (like cd or source) is executed, the output is not captured properly - this will need to be changed at some point
if "cd " in command or "source " in command:
@@ -121,7 +126,7 @@ def execute_command(project, command, timeout=None, force=False):
# if we do, use it
project.checkpoints['last_command_run'] = command_run
print(yellow(f'Restoring command run response id {command_run.id}:\n```\n{command_run.cli_response}```'))
return command_run.cli_response
return command_run.cli_response, None
return_value = None
@@ -197,7 +202,7 @@ def execute_command(project, command, timeout=None, force=False):
command_run = save_command_run(project, command, return_value)
return return_value
return return_value, None
def build_directory_tree(path, prefix="", ignore=None, is_last=False, files=None, add_descriptions=False):
"""Build the directory tree structure in tree-like format.
@@ -248,9 +253,10 @@ def execute_command_and_check_cli_response(command, timeout, convo):
Returns:
tuple: A tuple containing the CLI response and the agent's response.
"""
cli_response = execute_command(convo.agent.project, command, timeout)
response = convo.send_message('dev_ops/ran_command.prompt',
{ 'cli_response': cli_response, 'command': command })
cli_response, response = execute_command(convo.agent.project, command, timeout)
if response is None:
response = convo.send_message('dev_ops/ran_command.prompt',
{ 'cli_response': cli_response, 'command': command })
return cli_response, response
def run_command_until_success(command, timeout, convo, additional_message=None, force=False, return_cli_response=False, is_root_task=False):