diff --git a/autogpts/autogpt/autogpt/app/utils.py b/autogpts/autogpt/autogpt/app/utils.py index 6474836b3..921ba7b51 100644 --- a/autogpts/autogpt/autogpt/app/utils.py +++ b/autogpts/autogpt/autogpt/app/utils.py @@ -61,7 +61,7 @@ def clean_input(config: Config, prompt: str = ""): def get_bulletin_from_web(): try: response = requests.get( - "https://raw.githubusercontent.com/Significant-Gravitas/Auto-GPT/master/BULLETIN.md" + "https://raw.githubusercontent.com/Significant-Gravitas/Auto-GPT/master/autogpts/autogpt/BULLETIN.md" ) if response.status_code == 200: return response.text diff --git a/autogpts/autogpt/autogpt/command_decorator.py b/autogpts/autogpt/autogpt/command_decorator.py index 7f6e74565..17552206c 100644 --- a/autogpts/autogpt/autogpt/command_decorator.py +++ b/autogpts/autogpt/autogpt/command_decorator.py @@ -30,7 +30,7 @@ def command( ) -> Callable[..., CommandOutput]: """The command decorator is used to create Command objects from ordinary functions.""" - def decorator(func: Callable[..., CommandOutput]) -> Command: + def decorator(func: Callable[..., CommandOutput]): typed_parameters = [ CommandParameter( name=param_name, @@ -55,8 +55,7 @@ def command( def wrapper(*args, **kwargs) -> Any: return func(*args, **kwargs) - wrapper.command = cmd - + setattr(wrapper, "command", cmd) setattr(wrapper, AUTO_GPT_COMMAND_IDENTIFIER, True) return wrapper diff --git a/autogpts/autogpt/tests/integration/test_execute_code.py b/autogpts/autogpt/tests/integration/test_execute_code.py index b1e562536..01eddf0f8 100644 --- a/autogpts/autogpt/tests/integration/test_execute_code.py +++ b/autogpts/autogpt/tests/integration/test_execute_code.py @@ -41,28 +41,15 @@ def test_execute_python_file(python_test_file: str, random_string: str, agent: A def test_execute_python_code(random_code: str, random_string: str, agent: Agent): - ai_name = agent.ai_config.ai_name - - result: str = sut.execute_python_code(random_code, "test_code", agent=agent) + result: str = sut.execute_python_code(random_code, agent=agent) assert result.replace("\r", "") == f"Hello {random_string}!\n" - # Check that the code is stored - destination = os.path.join( - agent.config.workspace_path, ai_name, "executed_code", "test_code.py" - ) - with open(destination) as f: - assert f.read() == random_code - def test_execute_python_code_disallows_name_arg_path_traversal( random_code: str, agent: Agent ): with pytest.raises(AccessDeniedError, match="path traversal"): - sut.execute_python_code(random_code, name="../../test_code", agent=agent) - - # Check that the code is not stored in parent directory - dst_with_traversal = agent.workspace.get_path("test_code.py") - assert not dst_with_traversal.is_file(), "Path traversal by filename not prevented" + sut.execute_python_code(random_code, agent=agent) def test_execute_python_code_overwrites_file(random_code: str, agent: Agent): @@ -75,7 +62,7 @@ def test_execute_python_code_overwrites_file(random_code: str, agent: Agent): with open(destination, "w+") as f: f.write("This will be overwritten") - sut.execute_python_code(random_code, "test_code.py", agent=agent) + sut.execute_python_code(random_code, agent=agent) # Check that the file is updated with the new code with open(destination) as f: diff --git a/autogpts/autogpt/tests/unit/test_config.py b/autogpts/autogpt/tests/unit/test_config.py index 9d63b26a3..b851d5599 100644 --- a/autogpts/autogpt/tests/unit/test_config.py +++ b/autogpts/autogpt/tests/unit/test_config.py @@ -21,7 +21,7 @@ def test_initial_values(config: Config) -> None: assert config.debug_mode == False assert config.continuous_mode == False assert config.speak_mode == False - assert config.fast_llm == "gpt-3.5-turbo" + assert config.fast_llm == "gpt-3.5-turbo-16k" assert config.smart_llm == "gpt-4-0314" diff --git a/autogpts/autogpt/tests/unit/test_file_operations.py b/autogpts/autogpt/tests/unit/test_file_operations.py index fbf9769ac..36e01e048 100644 --- a/autogpts/autogpt/tests/unit/test_file_operations.py +++ b/autogpts/autogpt/tests/unit/test_file_operations.py @@ -245,10 +245,9 @@ def test_write_file_succeeds_if_content_different( test_file_with_content_path: Path, agent: Agent ): new_content = "This is different content.\n" - result = file_ops.write_to_file( + file_ops.write_to_file( str(test_file_with_content_path), new_content, agent=agent ) - assert result == "File written to successfully." def test_append_to_file(test_nested_file: Path, agent: Agent): @@ -301,7 +300,7 @@ def test_list_files(workspace: Workspace, test_directory: Path, agent: Agent): with open(os.path.join(test_directory, file_a.name), "w") as f: f.write("This is file A in the subdirectory.") - files = file_ops.list_files(str(workspace.root), agent=agent) + files = file_ops.list_folder(str(workspace.root), agent=agent) assert file_a.name in files assert file_b.name in files assert os.path.join(Path(test_directory).name, file_a.name) in files @@ -314,5 +313,5 @@ def test_list_files(workspace: Workspace, test_directory: Path, agent: Agent): # Case 2: Search for a file that does not exist and make sure we don't throw non_existent_file = "non_existent_file.txt" - files = file_ops.list_files("", agent=agent) + files = file_ops.list_folder("", agent=agent) assert non_existent_file not in files