migrate generate_script -> run_with (BE) (#3550)

This commit is contained in:
Jonathan Dobson
2025-09-29 15:14:15 -04:00
committed by GitHub
parent e04f81fcda
commit 2a3cc647a5
10 changed files with 63 additions and 33 deletions

View File

@@ -1396,7 +1396,7 @@ class AgentDB:
version: int | None = None,
is_saved_task: bool = False,
status: WorkflowStatus = WorkflowStatus.published,
generate_script: bool = False,
run_with: str | None = None,
ai_fallback: bool = False,
cache_key: str | None = None,
run_sequentially: bool = False,
@@ -1418,7 +1418,7 @@ class AgentDB:
model=model,
is_saved_task=is_saved_task,
status=status,
generate_script=generate_script,
run_with=run_with,
ai_fallback=ai_fallback,
cache_key=cache_key,
run_sequentially=run_sequentially,
@@ -1625,7 +1625,7 @@ class AgentDB:
description: str | None = None,
workflow_definition: dict[str, Any] | None = None,
version: int | None = None,
generate_script: bool | None = None,
run_with: str | None = None,
cache_key: str | None = None,
) -> Workflow:
try:
@@ -1644,8 +1644,8 @@ class AgentDB:
workflow.workflow_definition = workflow_definition
if version is not None:
workflow.version = version
if generate_script is not None:
workflow.generate_script = generate_script
if run_with is not None:
workflow.run_with = run_with
if cache_key is not None:
workflow.cache_key = cache_key
await session.commit()
@@ -2795,7 +2795,7 @@ class AgentDB:
max_screenshot_scrolling_times: int | None = None,
extra_http_headers: dict[str, str] | None = None,
browser_address: str | None = None,
generate_script: bool = False,
run_with: str | None = None,
) -> TaskV2:
async with self.Session() as session:
new_task_v2 = TaskV2Model(
@@ -2815,7 +2815,7 @@ class AgentDB:
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
extra_http_headers=extra_http_headers,
browser_address=browser_address,
generate_script=generate_script,
run_with=run_with,
)
session.add(new_task_v2)
await session.commit()

View File

@@ -245,6 +245,7 @@ class WorkflowModel(Base):
model = Column(JSON, nullable=True)
status = Column(String, nullable=False, default="published")
generate_script = Column(Boolean, default=False, nullable=False)
run_with = Column(String, nullable=True) # 'agent' or 'code'
ai_fallback = Column(Boolean, default=False, nullable=False)
cache_key = Column(String, nullable=True)
run_sequentially = Column(Boolean, nullable=True)
@@ -704,7 +705,8 @@ class TaskV2Model(Base):
max_screenshot_scrolling_times = Column(Integer, nullable=True)
extra_http_headers = Column(JSON, nullable=True)
browser_address = Column(String, nullable=True)
generate_script = Column(Boolean, nullable=False, default=False)
generate_script = Column(Boolean, default=False, nullable=False)
run_with = Column(String, nullable=True) # 'agent' or 'code'
queued_at = Column(DateTime, nullable=True)
started_at = Column(DateTime, nullable=True)

View File

@@ -280,7 +280,7 @@ def convert_to_workflow(workflow_model: WorkflowModel, debug_enabled: bool = Fal
deleted_at=workflow_model.deleted_at,
status=WorkflowStatus(workflow_model.status),
extra_http_headers=workflow_model.extra_http_headers,
generate_script=workflow_model.generate_script,
run_with=workflow_model.run_with,
ai_fallback=workflow_model.ai_fallback,
cache_key=workflow_model.cache_key,
run_sequentially=workflow_model.run_sequentially,