mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(agent/serve): Fix artifact creation
- Link agent-created artifacts to the corresponding step - Mark agent-created artifacts as such
This commit is contained in:
@@ -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 action
|
||||
if 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_args
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user