TEMP: 2 temp fixes

This commit is contained in:
Zvonimir Sabljic
2023-08-15 12:21:41 +02:00
parent cc4bc9a60e
commit 70c114814e

View File

@@ -71,8 +71,14 @@ class Developer(Agent):
convo.load_branch(function_uuid)
if step['type'] == 'command':
# TODO fix this - the problem is in GPT response that sometimes doesn't return the correct JSON structure
if isinstance(step['command'], str):
data = step
else:
data = step['command']
# TODO END
additional_message = 'Let\'s start with the step #0:\n\n' if i == 0 else f'So far, steps { ", ".join(f"#{j}" for j in range(i)) } are finished so let\'s do step #{i + 1} now.\n\n'
run_command_until_success(step['command']['command'], step['command']['timeout'], convo, additional_message=additional_message)
run_command_until_success(data['command'], data['timeout'], convo, additional_message=additional_message)
elif step['type'] == 'code_change' and 'code_change_description' in step:
# TODO this should be refactored so it always uses the same function call
@@ -83,7 +89,12 @@ class Developer(Agent):
self.test_code_changes(code_monkey, updated_convo)
elif step['type'] == 'code_change':
self.project.save_file(step['code_change'])
# TODO fix this - the problem is in GPT response that sometimes doesn't return the correct JSON structure
if 'code_change' not in step:
data = step
else:
data = step['code_change']
self.project.save_file(data)
# self.project.save_file(step if 'code_change' not in step else step['code_change'])
elif step['type'] == 'human_intervention':