Workflow Copilot: review and approve/reject changes (#4559)

This commit is contained in:
Stanislav Novosad
2026-01-27 13:24:44 -07:00
committed by GitHub
parent cb2a72775d
commit c0f361bb6e
10 changed files with 481 additions and 80 deletions

View File

@@ -140,6 +140,7 @@ from skyvern.schemas.workflows import BlockStatus, BlockType, WorkflowStatus
from skyvern.webeye.actions.actions import Action
LOG = structlog.get_logger()
_UNSET = object()
def _serialize_proxy_location(proxy_location: ProxyLocationInput) -> str | None:
@@ -3667,6 +3668,33 @@ class AgentDB(BaseAlchemyDB):
await session.refresh(new_chat)
return WorkflowCopilotChat.model_validate(new_chat)
async def update_workflow_copilot_chat(
self,
organization_id: str,
workflow_copilot_chat_id: str,
proposed_workflow: dict | None | object = _UNSET,
auto_accept: bool | None = None,
) -> WorkflowCopilotChat | None:
async with self.Session() as session:
chat = (
await session.scalars(
select(WorkflowCopilotChatModel)
.where(WorkflowCopilotChatModel.organization_id == organization_id)
.where(WorkflowCopilotChatModel.workflow_copilot_chat_id == workflow_copilot_chat_id)
)
).first()
if not chat:
return None
if proposed_workflow is not _UNSET:
chat.proposed_workflow = proposed_workflow
if auto_accept is not None:
chat.auto_accept = auto_accept
await session.commit()
await session.refresh(chat)
return WorkflowCopilotChat.model_validate(chat)
async def create_workflow_copilot_chat_message(
self,
organization_id: str,