mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-30 12:24:29 +01:00
formatting
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import time
|
||||
|
||||
from agent_protocol import Agent, Step, Task
|
||||
import time
|
||||
|
||||
import autogpt.utils
|
||||
|
||||
|
||||
class AutoGPT:
|
||||
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@@ -16,12 +16,13 @@ class AutoGPT:
|
||||
autogpt.utils.run(task.input)
|
||||
# print(f"Created Task id: {task.task_id}")
|
||||
return task
|
||||
|
||||
|
||||
async def step_handler(self, step: Step) -> Step:
|
||||
# print(f"step: {step}")
|
||||
agent_step = await Agent.db.get_step(step.task_id, step.step_id)
|
||||
updated_step: Step = await Agent.db.update_step(agent_step.task_id, agent_step.step_id, status="completed")
|
||||
updated_step: Step = await Agent.db.update_step(
|
||||
agent_step.task_id, agent_step.step_id, status="completed"
|
||||
)
|
||||
updated_step.output = agent_step.input
|
||||
print(f"Step completed: {updated_step}")
|
||||
return updated_step
|
||||
|
||||
@@ -9,7 +9,7 @@ import sqlite3
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from agent_protocol import Artifact, Step, Task, TaskDB
|
||||
from agent_protocol.models import TaskInput, Status
|
||||
from agent_protocol.models import Status, TaskInput
|
||||
|
||||
|
||||
class DataNotFoundError(Exception):
|
||||
@@ -135,8 +135,19 @@ class AgentDB(TaskDB):
|
||||
steps = cursor.fetchall()
|
||||
if steps:
|
||||
for step in steps:
|
||||
status = Status.created if step[3] == "created" else Status.completed
|
||||
task.steps.append(Step(task_id=step[1], step_id=step[0], name=step[2], status=status, is_last=True if step[4] == 1 else False, additional_properties=step[5]))
|
||||
status = (
|
||||
Status.created if step[3] == "created" else Status.completed
|
||||
)
|
||||
task.steps.append(
|
||||
Step(
|
||||
task_id=step[1],
|
||||
step_id=step[0],
|
||||
name=step[2],
|
||||
status=status,
|
||||
is_last=True if step[4] == 1 else False,
|
||||
additional_properties=step[5],
|
||||
)
|
||||
)
|
||||
# print(f"Getting task {task_id}.... Task details: {task}")
|
||||
return task
|
||||
else:
|
||||
|
||||
7
test.py
7
test.py
@@ -1,7 +1,9 @@
|
||||
DATABASE_NAME="agent.db"
|
||||
DATABASE_NAME = "agent.db"
|
||||
import sqlite3
|
||||
|
||||
# Read all data from database
|
||||
|
||||
|
||||
def read_all():
|
||||
conn = sqlite3.connect(DATABASE_NAME)
|
||||
cur = conn.cursor()
|
||||
@@ -10,4 +12,5 @@ def read_all():
|
||||
conn.close()
|
||||
return rows
|
||||
|
||||
print(read_all())
|
||||
|
||||
print(read_all())
|
||||
|
||||
Reference in New Issue
Block a user