mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Add message to explain exit.
This commit is contained in:
@@ -35,6 +35,7 @@ class Config(metaclass=Singleton):
|
|||||||
"""Initialize the Config class"""
|
"""Initialize the Config class"""
|
||||||
self.debug_mode = False
|
self.debug_mode = False
|
||||||
self.continuous_mode = False
|
self.continuous_mode = False
|
||||||
|
self.continuous_limit = 0
|
||||||
self.speak_mode = False
|
self.speak_mode = False
|
||||||
|
|
||||||
self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo")
|
self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo")
|
||||||
@@ -89,6 +90,10 @@ class Config(metaclass=Singleton):
|
|||||||
"""Set the continuous mode value."""
|
"""Set the continuous mode value."""
|
||||||
self.continuous_mode = value
|
self.continuous_mode = value
|
||||||
|
|
||||||
|
def set_continuous_limit(self, value: int):
|
||||||
|
"""Set the continuous limit value."""
|
||||||
|
self.continuous_limit = value
|
||||||
|
|
||||||
def set_speak_mode(self, value: bool):
|
def set_speak_mode(self, value: bool):
|
||||||
"""Set the speak mode value."""
|
"""Set the speak mode value."""
|
||||||
self.speak_mode = value
|
self.speak_mode = value
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ def parse_arguments():
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Process arguments.')
|
parser = argparse.ArgumentParser(description='Process arguments.')
|
||||||
parser.add_argument('--continuous', action='store_true', help='Enable Continuous Mode')
|
parser.add_argument('--continuous', action='store_true', help='Enable Continuous Mode')
|
||||||
|
parser.add_argument('--continuous-limit', '-l', type=int, default=0, dest="continuous_limit", help='Defines the number of times to run in continuous mode')
|
||||||
parser.add_argument('--speak', action='store_true', help='Enable Speak Mode')
|
parser.add_argument('--speak', action='store_true', help='Enable Speak Mode')
|
||||||
parser.add_argument('--debug', action='store_true', help='Enable Debug Mode')
|
parser.add_argument('--debug', action='store_true', help='Enable Debug Mode')
|
||||||
parser.add_argument('--gpt3only', action='store_true', help='Enable GPT3.5 Only Mode')
|
parser.add_argument('--gpt3only', action='store_true', help='Enable GPT3.5 Only Mode')
|
||||||
@@ -290,6 +291,16 @@ def parse_arguments():
|
|||||||
"Continuous mode is not recommended. It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorise. Use at your own risk.")
|
"Continuous mode is not recommended. It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorise. Use at your own risk.")
|
||||||
cfg.set_continuous_mode(True)
|
cfg.set_continuous_mode(True)
|
||||||
|
|
||||||
|
if args.continuous_limit and not args.continuous:
|
||||||
|
parser.error("--continuous-limit can only be used with --continuous")
|
||||||
|
|
||||||
|
if args.continuous_limit > 0:
|
||||||
|
logger.typewriter_log(
|
||||||
|
"Continuous Limit: ",
|
||||||
|
Fore.GREEN,
|
||||||
|
f"{args.continuous_limit}")
|
||||||
|
cfg.set_continuous_limit(args.continuous_limit)
|
||||||
|
|
||||||
if args.speak:
|
if args.speak:
|
||||||
logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED")
|
logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED")
|
||||||
cfg.set_speak_mode(True)
|
cfg.set_speak_mode(True)
|
||||||
@@ -337,7 +348,14 @@ 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
|
||||||
|
loop_count = 0
|
||||||
while True:
|
while True:
|
||||||
|
# Discontinue if continuous limit is reached
|
||||||
|
loop_count += 1
|
||||||
|
if cfg.continuous_mode and cfg.continuous_limit > 0 and loop_count > cfg.continuous_limit:
|
||||||
|
logger.typewriter_log("Continuous Limit Reached: ", Fore.RED, f"{cfg.continuous_limit}")
|
||||||
|
break
|
||||||
|
|
||||||
# Send message to AI, get response
|
# Send message to AI, get response
|
||||||
with Spinner("Thinking... "):
|
with Spinner("Thinking... "):
|
||||||
assistant_reply = chat.chat_with_ai(
|
assistant_reply = chat.chat_with_ai(
|
||||||
|
|||||||
Reference in New Issue
Block a user