mirror of
https://github.com/langgenius/dify.git
synced 2026-05-01 07:58:02 +08:00
completed workflow engine main logic
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from models.workflow import WorkflowNodeExecutionStatus
|
||||
|
||||
|
||||
class NodeType(Enum):
|
||||
@ -39,3 +44,19 @@ class SystemVariable(Enum):
|
||||
QUERY = 'query'
|
||||
FILES = 'files'
|
||||
CONVERSATION = 'conversation'
|
||||
|
||||
|
||||
class NodeRunResult(BaseModel):
|
||||
"""
|
||||
Node Run Result.
|
||||
"""
|
||||
status: WorkflowNodeExecutionStatus = WorkflowNodeExecutionStatus.RUNNING
|
||||
|
||||
inputs: Optional[dict] = None # node inputs
|
||||
process_data: Optional[dict] = None # process data
|
||||
outputs: Optional[dict] = None # node outputs
|
||||
metadata: Optional[dict] = None # node metadata
|
||||
|
||||
edge_source_handle: Optional[str] = None # source handle id of node with multiple branches
|
||||
|
||||
error: Optional[str] = None # error message if status is failed
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from core.workflow.entities.variable_pool import VariablePool
|
||||
from models.workflow import WorkflowNodeExecution, WorkflowRun
|
||||
|
||||
@ -10,7 +8,10 @@ class WorkflowRunState:
|
||||
variable_pool: VariablePool
|
||||
|
||||
total_tokens: int = 0
|
||||
total_price: Decimal = Decimal(0)
|
||||
currency: str = "USD"
|
||||
|
||||
workflow_node_executions: list[WorkflowNodeExecution] = []
|
||||
|
||||
def __init__(self, workflow_run: WorkflowRun, start_at: float, variable_pool: VariablePool) -> None:
|
||||
self.workflow_run = workflow_run
|
||||
self.start_at = start_at
|
||||
self.variable_pool = variable_pool
|
||||
|
||||
Reference in New Issue
Block a user