22import signal
33import sys
44from datetime import datetime
5+ from pathlib import Path
56
67from colorama import Fore , Style
78
@@ -64,7 +65,7 @@ def __init__(
6465 ai_config : AIConfig ,
6566 system_prompt : str ,
6667 triggering_prompt : str ,
67- workspace_directory : str ,
68+ workspace_directory : str | Path ,
6869 config : Config ,
6970 ):
7071 self .ai_name = ai_name
@@ -80,13 +81,11 @@ def __init__(
8081 self .created_at = datetime .now ().strftime ("%Y%m%d_%H%M%S" )
8182 self .cycle_count = 0
8283 self .log_cycle_handler = LogCycleHandler ()
83- self .fast_token_limit = OPEN_AI_CHAT_MODELS .get (
84- config .fast_llm_model
85- ).max_tokens
84+ self .smart_token_limit = OPEN_AI_CHAT_MODELS .get (config .smart_llm ).max_tokens
8685
8786 def start_interaction_loop (self ):
8887 # Avoid circular imports
89- from autogpt .app import execute_command , get_command
88+ from autogpt .app import execute_command , extract_command
9089
9190 # Interaction Loop
9291 self .cycle_count = 0
@@ -137,8 +136,8 @@ def signal_handler(signum, frame):
137136 self ,
138137 self .system_prompt ,
139138 self .triggering_prompt ,
140- self .fast_token_limit ,
141- self .config .fast_llm_model ,
139+ self .smart_token_limit ,
140+ self .config .smart_llm ,
142141 )
143142
144143 try :
@@ -162,11 +161,11 @@ def signal_handler(signum, frame):
162161 print_assistant_thoughts (
163162 self .ai_name , assistant_reply_json , self .config
164163 )
165- command_name , arguments = get_command (
164+ command_name , arguments = extract_command (
166165 assistant_reply_json , assistant_reply , self .config
167166 )
168167 if self .config .speak_mode :
169- say_text (f"I want to execute { command_name } " )
168+ say_text (f"I want to execute { command_name } " , self . config )
170169
171170 arguments = self ._resolve_pathlike_command_args (arguments )
172171
@@ -195,8 +194,9 @@ def signal_handler(signum, frame):
195194 # to exit
196195 self .user_input = ""
197196 logger .info (
198- "Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, "
199- "'n' to exit program, or enter feedback for "
197+ f"Enter '{ self .config .authorise_key } ' to authorise command, "
198+ f"'{ self .config .authorise_key } -N' to run N continuous commands, "
199+ f"'{ self .config .exit_key } ' to exit program, or enter feedback for "
200200 f"{ self .ai_name } ..."
201201 )
202202 while True :
@@ -224,8 +224,8 @@ def signal_handler(signum, frame):
224224 user_input = "GENERATE NEXT COMMAND JSON"
225225 except ValueError :
226226 logger .warn (
227- "Invalid input format. Please enter 'y -n' where n is "
228- " the number of continuous tasks."
227+ f "Invalid input format. Please enter '{ self . config . authorise_key } -n' "
228+ "where n is the number of continuous tasks."
229229 )
230230 continue
231231 break
@@ -281,12 +281,12 @@ def signal_handler(signum, frame):
281281 result = f"Command { command_name } returned: " f"{ command_result } "
282282
283283 result_tlength = count_string_tokens (
284- str (command_result ), self .config .fast_llm_model
284+ str (command_result ), self .config .smart_llm
285285 )
286286 memory_tlength = count_string_tokens (
287- str (self .history .summary_message ()), self .config .fast_llm_model
287+ str (self .history .summary_message ()), self .config .smart_llm
288288 )
289- if result_tlength + memory_tlength + 600 > self .fast_token_limit :
289+ if result_tlength + memory_tlength + 600 > self .smart_token_limit :
290290 result = f"Failure: command { command_name } returned too much output. \
291291 Do not execute this command again with the same arguments."
292292
0 commit comments