Added callback to ask_for_human_intervention

This commit is contained in:
Zvonimir Sabljic
2023-08-16 11:36:47 +02:00
parent de922a973e
commit 3322c8f52f
2 changed files with 7 additions and 2 deletions

View File

@@ -170,7 +170,7 @@ class Project:
delete_unconnected_steps_from(self.checkpoints['last_command_run'], 'previous_step')
delete_unconnected_steps_from(self.checkpoints['last_user_input'], 'previous_step')
def ask_for_human_intervention(self, message, description=None):
def ask_for_human_intervention(self, message, description=None, cbs={}):
print(colored(message, "yellow"))
if description is not None:
print(description)
@@ -181,6 +181,9 @@ class Project:
'Once you are ready, type "continue" to continue.',
)
if answer in cbs:
return cbs[answer]()
if answer != '' and answer != 'continue':
confirmation = styled_text(
self,

View File

@@ -120,7 +120,9 @@ class Developer(Agent):
def continue_development(self):
while True:
user_feedback = self.project.ask_for_human_intervention('Can you check if all this works?')
user_feedback = self.project.ask_for_human_intervention(
'Can you check if all this works? If you want to run the app, just type "r" and press ENTER',
cbs={ 'r': lambda: run_command_until_success(self.run_command, None, iteration_convo, force=True) })
if user_feedback == 'DONE':
return True