From 2af9cf853aac6b91a7fac26dfccc28d1c6bfa4cb Mon Sep 17 00:00:00 2001 From: Preston Jensen Date: Mon, 3 Apr 2023 20:12:11 -0600 Subject: [PATCH] human feedback in manual mode --- scripts/main.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/main.py b/scripts/main.py index 97c05d7db..03f656b07 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -303,7 +303,7 @@ while True: Fore.CYAN, f"COMMAND = {Fore.CYAN}{command_name}{Style.RESET_ALL} ARGUMENTS = {Fore.CYAN}{arguments}{Style.RESET_ALL}") print( - "Enter 'y' to authorise command or 'n' to exit program...", + f"Enter 'y' to authorise command or 'n' to exit program, or enter feedback for {ai_name}...", flush=True) while True: console_input = input(Fore.MAGENTA + "Input:" + Style.RESET_ALL) @@ -314,16 +314,18 @@ while True: user_input = "EXIT" break else: - continue + user_input = console_input + command_name = "human_feedback" + break - if user_input != "GENERATE NEXT COMMAND JSON": - print("Exiting...", flush=True) - break - - print_to_console( + if user_input == "GENERATE NEXT COMMAND JSON": + print_to_console( "-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=", Fore.MAGENTA, "") + elif user_input == "EXIT": + print("Exiting...", flush=True) + break else: # Print command print_to_console( @@ -332,10 +334,12 @@ while True: f"COMMAND = {Fore.CYAN}{command_name}{Style.RESET_ALL} ARGUMENTS = {Fore.CYAN}{arguments}{Style.RESET_ALL}") # Execute command - if command_name.lower() != "error": - result = f"Command {command_name} returned: {cmd.execute_command(command_name, arguments)}" - else: + if command_name.lower() == "error": result = f"Command {command_name} threw the following error: " + arguments + elif command_name == "human_feedback": + result = f"Human feedback: {user_input}" + else: + result = f"Command {command_name} returned: {cmd.execute_command(command_name, arguments)}" # Check if there's a result from the command append it to the message # history @@ -347,3 +351,4 @@ while True: chat.create_chat_message( "system", "Unable to execute command")) print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") +