Skip to content

Commit

Permalink
Merge pull request Significant-Gravitas#133 from prestoj/human-feedba…
Browse files Browse the repository at this point in the history
…ck-in-manual-mode

human feedback in manual mode
  • Loading branch information
Torantulino authored Apr 4, 2023
2 parents f294ba8 + 2af9cf8 commit 364b772
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def parse_arguments():
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)
Expand All @@ -322,16 +322,18 @@ def parse_arguments():
user_input = "EXIT"
break
else:
continue

if user_input != "GENERATE NEXT COMMAND JSON":
print("Exiting...", flush=True)
break
user_input = console_input
command_name = "human_feedback"
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(
Expand All @@ -340,10 +342,12 @@ def parse_arguments():
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
Expand All @@ -355,3 +359,4 @@ def parse_arguments():
chat.create_chat_message(
"system", "Unable to execute command"))
print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command")

0 comments on commit 364b772

Please sign in to comment.