diff --git a/pilot/const/ipc.py b/pilot/const/ipc.py index 22729e5..fb02916 100644 --- a/pilot/const/ipc.py +++ b/pilot/const/ipc.py @@ -1,7 +1,8 @@ MESSAGE_TYPE = { 'verbose': 'verbose', 'stream': 'stream', - 'user_input_request': 'user_input_request', - 'info': 'info', + 'user_input_request': 'user_input_request', # Displayed above the + 'hint': 'hint', # Hint text, eg "Do you want to add anything else? If not, just press ENTER." + 'info': 'info', # JSON data can be sent to progress `progress_stage` 'local': 'local', -} \ No newline at end of file +} diff --git a/pilot/helpers/AgentConvo.py b/pilot/helpers/AgentConvo.py index 928320b..36c08a9 100644 --- a/pilot/helpers/AgentConvo.py +++ b/pilot/helpers/AgentConvo.py @@ -125,8 +125,9 @@ class AgentConvo: # Continue conversation until GPT response equals END_RESPONSE while response != END_RESPONSE: - print(yellow("Do you want to add anything else? If not, ") + yellow_bold('just press ENTER.')) - user_message = ask_user(self.agent.project, response, False) + user_message = ask_user(self.agent.project, response, + hint=yellow("Do you want to add anything else? If not, ") + yellow_bold('just press ENTER.'), + require_some_input=False) if user_message == "": accepted_messages.append(response) diff --git a/pilot/prompts/prompts.py b/pilot/prompts/prompts.py index 0491080..965db3f 100644 --- a/pilot/prompts/prompts.py +++ b/pilot/prompts/prompts.py @@ -49,8 +49,10 @@ def ask_for_main_app_definition(project): return description -def ask_user(project, question, require_some_input=True): +def ask_user(project, question: str, require_some_input=True, hint: str = None): while True: + if hint is not None: + print(hint, type='hint') answer = styled_text(project, question) if answer is None: @@ -72,7 +74,7 @@ def get_additional_info_from_openai(project, messages): if response is not None: if response['text'].strip() == END_RESPONSE: - print(response['text'] + '\n') + # print(response['text'] + '\n') return messages # Ask the question to the user @@ -100,7 +102,7 @@ def get_additional_info_from_user(project, messages, role): if isinstance(message, dict) and 'text' in message: message = message['text'] print(yellow(f"Please check this message and say what needs to be changed. If everything is ok just press ENTER",)) - answer = ask_user(project, message, False) + answer = ask_user(project, message, require_some_input=False) if answer.lower() == '': break response = create_gpt_chat_completion(