loop_over, current_value and current_index in the workflow_run_blocks table (#1425)

This commit is contained in:
Shuchang Zheng
2024-12-23 01:13:25 -08:00
committed by GitHub
parent 2029c0c41f
commit 68dae6dddd
5 changed files with 71 additions and 1 deletions

View File

@@ -2084,6 +2084,9 @@ class AgentDB:
failure_reason: str | None = None,
task_id: str | None = None,
organization_id: str | None = None,
loop_values: list | None = None,
current_value: str | None = None,
current_index: int | None = None,
) -> WorkflowRunBlock:
async with self.Session() as session:
workflow_run_block = (
@@ -2102,6 +2105,12 @@ class AgentDB:
workflow_run_block.task_id = task_id
if failure_reason:
workflow_run_block.failure_reason = failure_reason
if loop_values:
workflow_run_block.loop_values = loop_values
if current_value:
workflow_run_block.current_value = current_value
if current_index:
workflow_run_block.current_index = current_index
await session.commit()
await session.refresh(workflow_run_block)
else:

View File

@@ -504,6 +504,9 @@ class WorkflowRunBlockModel(Base):
output = Column(JSON, nullable=True)
continue_on_failure = Column(Boolean, nullable=False, default=False)
failure_reason = Column(String, nullable=True)
loop_values = Column(JSON, nullable=True)
current_value = Column(String, nullable=True)
current_index = Column(Integer, nullable=True)
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)