Fix agent remembering do nothing command, use correct google function, disabled image_gen if not configured.

pull/2531/head
BillSchumacher 2023-04-16 22:46:38 -05:00
parent 03c137741a
commit c0aa423d7b
No known key found for this signature in database
GPG Key ID: 1133789BDD03E12A
3 changed files with 24 additions and 23 deletions

View File

@ -187,24 +187,24 @@ class Agent:
result = plugin.post_command(command_name, result) result = plugin.post_command(command_name, result)
if self.next_action_count > 0: if self.next_action_count > 0:
self.next_action_count -= 1 self.next_action_count -= 1
if command_name != "do_nothing":
memory_to_add = ( memory_to_add = (
f"Assistant Reply: {assistant_reply} " f"Assistant Reply: {assistant_reply} "
f"\nResult: {result} " f"\nResult: {result} "
f"\nHuman Feedback: {user_input} " f"\nHuman Feedback: {user_input} "
)
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(create_chat_message("system", result))
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
) )
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(create_chat_message("system", result))
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
)

View File

@ -11,7 +11,7 @@ from autogpt.config import Config
CFG = Config() CFG = Config()
@command("google", "Google Search", '"input": "<search>"', not CFG.google_api_key) @command("google", "Google Search", '"query": "<search>"', not CFG.google_api_key)
def google_search(query: str, num_results: int = 8) -> str: def google_search(query: str, num_results: int = 8) -> str:
"""Return the results of a google search """Return the results of a google search
@ -40,7 +40,7 @@ def google_search(query: str, num_results: int = 8) -> str:
@command( @command(
"google", "google",
"Google Search", "Google Search",
'"input": "<search>"', '"query": "<search>"',
bool(CFG.google_api_key), bool(CFG.google_api_key),
"Configure google_api_key.", "Configure google_api_key.",
) )

View File

@ -14,7 +14,8 @@ from autogpt.workspace import path_in_workspace
CFG = Config() CFG = Config()
@command("generate_image", "Generate Image", '"prompt": "<prompt>"') @command("generate_image", "Generate Image", '"prompt": "<prompt>"',
CFG.image_provider)
def generate_image(prompt: str) -> str: def generate_image(prompt: str) -> str:
"""Generate an image from a prompt. """Generate an image from a prompt.