mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
put loop in in if main
This commit is contained in:
@@ -316,6 +316,8 @@ def parse_arguments():
|
|||||||
cfg.memory_backend = chosen
|
cfg.memory_backend = chosen
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
global ai_name, memory
|
||||||
# TODO: fill in llm values here
|
# TODO: fill in llm values here
|
||||||
check_openai_api_key()
|
check_openai_api_key()
|
||||||
parse_arguments()
|
parse_arguments()
|
||||||
@@ -329,12 +331,10 @@ result = None
|
|||||||
next_action_count = 0
|
next_action_count = 0
|
||||||
# Make a constant:
|
# Make a constant:
|
||||||
user_input = "Determine which next command to use, and respond using the format specified above:"
|
user_input = "Determine which next command to use, and respond using the format specified above:"
|
||||||
|
|
||||||
# Initialize memory and make sure it is empty.
|
# Initialize memory and make sure it is empty.
|
||||||
# this is particularly important for indexing and referencing pinecone memory
|
# this is particularly important for indexing and referencing pinecone memory
|
||||||
memory = get_memory(cfg, init=True)
|
memory = get_memory(cfg, init=True)
|
||||||
print('Using memory of type: ' + memory.__class__.__name__)
|
print('Using memory of type: ' + memory.__class__.__name__)
|
||||||
|
|
||||||
# Interaction Loop
|
# Interaction Loop
|
||||||
while True:
|
while True:
|
||||||
# Send message to AI, get response
|
# Send message to AI, get response
|
||||||
@@ -351,7 +351,8 @@ while True:
|
|||||||
|
|
||||||
# Get command name and arguments
|
# Get command name and arguments
|
||||||
try:
|
try:
|
||||||
command_name, arguments = cmd.get_command(attempt_to_fix_json_by_finding_outermost_brackets(assistant_reply))
|
command_name, arguments = cmd.get_command(
|
||||||
|
attempt_to_fix_json_by_finding_outermost_brackets(assistant_reply))
|
||||||
if cfg.speak_mode:
|
if cfg.speak_mode:
|
||||||
speak.say_text(f"I want to execute {command_name}")
|
speak.say_text(f"I want to execute {command_name}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -431,3 +432,7 @@ while True:
|
|||||||
chat.create_chat_message(
|
chat.create_chat_message(
|
||||||
"system", "Unable to execute command"))
|
"system", "Unable to execute command"))
|
||||||
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, "Unable to execute command")
|
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, "Unable to execute command")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user