mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
Change the is_resumption field in WorkflowStarted event into reason (vibe-kanban 19ac040e)
Reason should be an enumeration with only one member `resumption` currently. Please update these part of events: - Graph / Engine Event (GraphRunStartedEvent) - Queue event (QueueWorkflowStartedEvent) - SSE response event (WorkflowStartStreamResponse) Besides, you should remove the `is_resumption` flag for `node_started` events; including: - Queue Event (`QueueNodeStartedEvent`) - SSE Event (`NodeStartStreamResponse`) - Node event (`NodeRunStartedEvent`) After finishing the changes above, adjust related tests. You should run the affected tests and ensure they can pass. (You should use `uv run pytest` to run tests)
This commit is contained in:
@ -1,13 +1,16 @@
|
||||
from pydantic import Field
|
||||
|
||||
from core.workflow.entities.pause_reason import PauseReason
|
||||
from core.workflow.entities.workflow_start_reason import WorkflowStartReason
|
||||
from core.workflow.graph_events import BaseGraphEvent
|
||||
|
||||
|
||||
class GraphRunStartedEvent(BaseGraphEvent):
|
||||
# is_resumption indicating whether this `start` is a
|
||||
# resumption of previously suspended execution.
|
||||
is_resumption: bool = False
|
||||
# Reason is emitted for workflow start events and is always set.
|
||||
reason: WorkflowStartReason = Field(
|
||||
default=WorkflowStartReason.INITIAL,
|
||||
description="reason for workflow start",
|
||||
)
|
||||
|
||||
|
||||
class GraphRunSucceededEvent(BaseGraphEvent):
|
||||
|
||||
@ -15,10 +15,6 @@ class NodeRunStartedEvent(GraphNodeEventBase):
|
||||
predecessor_node_id: str | None = None
|
||||
agent_strategy: AgentNodeStrategyInit | None = None
|
||||
start_at: datetime = Field(..., description="node start time")
|
||||
is_resumption: bool = Field(
|
||||
default=False,
|
||||
description="True only when this node had already started and execution resumed after a pause.",
|
||||
)
|
||||
|
||||
# FIXME(-LAN-): only for ToolNode
|
||||
provider_type: str = ""
|
||||
|
||||
Reference in New Issue
Block a user