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.
Fix web_search tests
Reinier van der Leer3cc8b2abf75a
diff --git a/autogpts/autogpt/autogpt/commands/web_search.py b/autogpts/autogpt/autogpt/commands/web_search.pyindex de77d5d1e0..8c9a9334ce 100644--- a/autogpts/autogpt/autogpt/commands/web_search.py+++ b/autogpts/autogpt/autogpt/commands/web_search.py@@ -58,7 +58,11 @@ def web_search(query: str, agent: Agent, num_results: int = 8) -> str:attempts += 1search_results = [- {"title": r["title"], "url": r["href"], "description": r["body"]}+ {+ "title": r["title"],+ "url": r["href"],+ **({"description": r["body"]} if r.get("body") else {}),+ }for r in search_results]diff --git a/autogpts/autogpt/tests/unit/test_web_search.py b/autogpts/autogpt/tests/unit/test_web_search.pyindex 7b57b9fa83..a8ccb0ce67 100644--- a/autogpts/autogpt/tests/unit/test_web_search.py+++ b/autogpts/autogpt/tests/unit/test_web_search.py@@ -29,8 +29,8 @@ def test_safe_google_results_invalid_input():("test",1,- '[\n {\n "title": "Result 1",\n "link": "https://example.com/result1"\n }\n]',- [{"title": "Result 1", "link": "https://example.com/result1"}],+ '[\n {\n "title": "Result 1",\n "url": "https://example.com/result1"\n }\n]',+ [{"title": "Result 1", "href": "https://example.com/result1"}],),("", 1, "[]", []),("no results", 1, "[]", []),