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(agent/serve): Fix artifact creation
Reinier van der Leer8985b7b01b87
diff --git a/autogpts/autogpt/autogpt/app/agent_protocol_server.py b/autogpts/autogpt/autogpt/app/agent_protocol_server.pyindex 2e620c1bd7..23b7f9d579 100644--- a/autogpts/autogpt/autogpt/app/agent_protocol_server.py+++ b/autogpts/autogpt/autogpt/app/agent_protocol_server.py@@ -169,11 +169,6 @@ class AgentProtocolServer:app_config=self.app_config,llm_provider=self.llm_provider,)- agent.workspace.on_write_file = lambda path: self.db.create_artifact(- task_id=task_id,- file_name=path.parts[-1],- relative_path=str(path),- )# According to the Agent Protocol spec, the first execute_step request contains# the same task input as the parent create_task request.@@ -214,6 +209,13 @@ class AgentProtocolServer:# Execute previously proposed actionif execute_command:assert execute_command_args is not None+ agent.workspace.on_write_file = lambda path: self.db.create_artifact(+ task_id=step.task_id,+ step_id=step.step_id,+ file_name=path.parts[-1],+ agent_created=True,+ relative_path=str(path),+ )if step.is_last and execute_command == finish.__name__:assert execute_command_argsdiff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.pyindex f50c22d3ab..43a911a019 100644--- a/autogpts/autogpt/autogpt/app/main.py+++ b/autogpts/autogpt/autogpt/app/main.py@@ -346,7 +346,10 @@ async def run_auto_gpt_server(config.plugins = scan_plugins(config)# Set up & start server- database = AgentDB(os.getenv("AP_SERVER_DB_URL", "sqlite:///data/ap_server.db"))+ database = AgentDB(+ database_string=os.getenv("AP_SERVER_DB_URL", "sqlite:///data/ap_server.db"),+ debug_enabled=debug,+ )server = AgentProtocolServer(app_config=config, database=database, llm_provider=llm_provider)