mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +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:
@ -315,7 +315,7 @@ class AdvancedChatAppGenerateTaskPipeline(GraphRuntimeStateSupport):
|
||||
task_id=self._application_generate_entity.task_id,
|
||||
workflow_run_id=run_id,
|
||||
workflow_id=self._workflow_id,
|
||||
is_resumption=event.is_resumption,
|
||||
reason=event.reason,
|
||||
)
|
||||
|
||||
yield workflow_start_resp
|
||||
|
||||
@ -47,6 +47,7 @@ from core.tools.tool_manager import ToolManager
|
||||
from core.trigger.trigger_manager import TriggerManager
|
||||
from core.variables.segments import ArrayFileSegment, FileSegment, Segment
|
||||
from core.workflow.entities.pause_reason import HumanInputRequired
|
||||
from core.workflow.entities.workflow_start_reason import WorkflowStartReason
|
||||
from core.workflow.enums import (
|
||||
NodeType,
|
||||
SystemVariableKey,
|
||||
@ -199,7 +200,7 @@ class WorkflowResponseConverter:
|
||||
task_id: str,
|
||||
workflow_run_id: str,
|
||||
workflow_id: str,
|
||||
is_resumption: bool,
|
||||
reason: WorkflowStartReason,
|
||||
) -> WorkflowStartStreamResponse:
|
||||
run_id = self._ensure_workflow_run_id(workflow_run_id)
|
||||
started_at = naive_utc_now()
|
||||
@ -213,7 +214,7 @@ class WorkflowResponseConverter:
|
||||
workflow_id=workflow_id,
|
||||
inputs=self._workflow_inputs,
|
||||
created_at=int(started_at.timestamp()),
|
||||
is_resumption=is_resumption,
|
||||
reason=reason,
|
||||
),
|
||||
)
|
||||
|
||||
@ -410,7 +411,6 @@ class WorkflowResponseConverter:
|
||||
iteration_id=event.in_iteration_id,
|
||||
loop_id=event.in_loop_id,
|
||||
agent_strategy=event.agent_strategy,
|
||||
is_resumption=event.is_resumption,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ class WorkflowAppGenerateTaskPipeline(GraphRuntimeStateSupport):
|
||||
task_id=self._application_generate_entity.task_id,
|
||||
workflow_run_id=run_id,
|
||||
workflow_id=self._workflow.id,
|
||||
is_resumption=event.is_resumption,
|
||||
reason=event.reason,
|
||||
)
|
||||
yield start_resp
|
||||
|
||||
|
||||
@ -359,7 +359,7 @@ class WorkflowBasedAppRunner:
|
||||
:param event: event
|
||||
"""
|
||||
if isinstance(event, GraphRunStartedEvent):
|
||||
self._publish_event(QueueWorkflowStartedEvent(is_resumption=event.is_resumption))
|
||||
self._publish_event(QueueWorkflowStartedEvent(reason=event.reason))
|
||||
elif isinstance(event, GraphRunSucceededEvent):
|
||||
self._publish_event(QueueWorkflowSucceededEvent(outputs=event.outputs))
|
||||
elif isinstance(event, GraphRunPartialSucceededEvent):
|
||||
@ -431,7 +431,6 @@ class WorkflowBasedAppRunner:
|
||||
agent_strategy=event.agent_strategy,
|
||||
provider_type=event.provider_type,
|
||||
provider_id=event.provider_id,
|
||||
is_resumption=event.is_resumption,
|
||||
)
|
||||
)
|
||||
elif isinstance(event, NodeRunSucceededEvent):
|
||||
|
||||
Reference in New Issue
Block a user