Add TaskRunResponse data to task v2 webhook (#2444)
This commit is contained in:
@@ -72,6 +72,7 @@ from skyvern.forge.sdk.workflow.models.workflow import (
|
||||
WorkflowStatus,
|
||||
)
|
||||
from skyvern.forge.sdk.workflow.models.yaml import WorkflowCreateYAMLRequest
|
||||
from skyvern.schemas.artifacts import EntityType, entity_type_to_param
|
||||
from skyvern.schemas.runs import (
|
||||
CUA_ENGINES,
|
||||
RunEngine,
|
||||
@@ -89,23 +90,6 @@ from skyvern.webeye.actions.actions import Action
|
||||
LOG = structlog.get_logger()
|
||||
|
||||
|
||||
class EntityType(str, Enum):
|
||||
STEP = "step"
|
||||
TASK = "task"
|
||||
WORKFLOW_RUN = "workflow_run"
|
||||
WORKFLOW_RUN_BLOCK = "workflow_run_block"
|
||||
THOUGHT = "thought"
|
||||
|
||||
|
||||
entity_type_to_param = {
|
||||
EntityType.STEP: "step_id",
|
||||
EntityType.TASK: "task_id",
|
||||
EntityType.WORKFLOW_RUN: "workflow_run_id",
|
||||
EntityType.WORKFLOW_RUN_BLOCK: "workflow_run_block_id",
|
||||
EntityType.THOUGHT: "thought_id",
|
||||
}
|
||||
|
||||
|
||||
class AISuggestionType(str, Enum):
|
||||
DATA_SCHEMA = "data_schema"
|
||||
|
||||
|
||||
18
skyvern/schemas/artifacts.py
Normal file
18
skyvern/schemas/artifacts.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class EntityType(StrEnum):
|
||||
STEP = "step"
|
||||
TASK = "task"
|
||||
WORKFLOW_RUN = "workflow_run"
|
||||
WORKFLOW_RUN_BLOCK = "workflow_run_block"
|
||||
THOUGHT = "thought"
|
||||
|
||||
|
||||
entity_type_to_param = {
|
||||
EntityType.STEP: "step_id",
|
||||
EntityType.TASK: "task_id",
|
||||
EntityType.WORKFLOW_RUN: "workflow_run_id",
|
||||
EntityType.WORKFLOW_RUN_BLOCK: "workflow_run_block_id",
|
||||
EntityType.THOUGHT: "thought_id",
|
||||
}
|
||||
@@ -60,7 +60,6 @@ from skyvern.forge.sdk.workflow.models.yaml import (
|
||||
WorkflowDefinitionYAML,
|
||||
)
|
||||
from skyvern.schemas.runs import ProxyLocation, RunEngine, RunType, TaskRunRequest, TaskRunResponse
|
||||
from skyvern.services import workflow_service
|
||||
from skyvern.utils.prompt_engine import load_prompt_with_elements
|
||||
from skyvern.webeye.browser_factory import BrowserState
|
||||
from skyvern.webeye.scraper.scraper import ScrapedPage, scrape_website
|
||||
@@ -1582,6 +1581,8 @@ async def _summarize_task_v2(
|
||||
|
||||
async def build_task_v2_run_response(task_v2: TaskV2) -> TaskRunResponse:
|
||||
"""Build TaskRunResponse object for webhook backward compatibility."""
|
||||
from skyvern.services import workflow_service
|
||||
|
||||
workflow_run_resp = None
|
||||
if task_v2.workflow_run_id:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user