Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Add list type check

SBNovaScript13602b4a63b1
diff --git a/autogpt/app.py b/autogpt/app.py
index 11ab97244e..6ead0d52e8 100644
--- a/autogpt/app.py
+++ b/autogpt/app.py
@@ -128,7 +128,13 @@ def execute_command(command_name: str, arguments):
return google_result
else:
google_result = google_search(arguments["input"])
- safe_message = [google_result_single.encode('utf-8', 'ignore') for google_result_single in google_result]
+
+ # google_result can be a list or a string depending on the search results
+ if isinstance(google_result, list):
+ safe_message = [google_result_single.encode('utf-8', 'ignore') for google_result_single in google_result]
+ else:
+ safe_message = google_result.encode('utf-8', 'ignore')
+
return str(safe_message)
elif command_name == "memory_add":
return memory.add(arguments["string"])