mirror of https://github.com/langgenius/dify.git
add sys variables for start node
This commit is contained in:
parent
464aee08a1
commit
53aca1a922
|
|
@ -24,6 +24,7 @@ class ValueType(Enum):
|
|||
class VariablePool:
|
||||
variables_mapping = {}
|
||||
user_inputs: dict
|
||||
system_variables: dict[SystemVariable, Any]
|
||||
|
||||
def __init__(self, system_variables: dict[SystemVariable, Any],
|
||||
user_inputs: dict) -> None:
|
||||
|
|
@ -34,6 +35,7 @@ class VariablePool:
|
|||
# 'files': []
|
||||
# }
|
||||
self.user_inputs = user_inputs
|
||||
self.system_variables = system_variables
|
||||
for system_variable, value in system_variables.items():
|
||||
self.append_variable('sys', [system_variable.value], value)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from typing import cast
|
|||
|
||||
from core.app.app_config.entities import VariableEntity
|
||||
from core.workflow.entities.base_node_data_entities import BaseNodeData
|
||||
from core.workflow.entities.node_entities import NodeRunResult, NodeType
|
||||
from core.workflow.entities.node_entities import NodeRunResult, NodeType, SystemVariable
|
||||
from core.workflow.entities.variable_pool import VariablePool
|
||||
from core.workflow.nodes.base_node import BaseNode
|
||||
from core.workflow.nodes.start.entities import StartNodeData
|
||||
|
|
@ -26,6 +26,12 @@ class StartNode(BaseNode):
|
|||
# Get cleaned inputs
|
||||
cleaned_inputs = self._get_cleaned_inputs(variables, variable_pool.user_inputs)
|
||||
|
||||
for var in variable_pool.system_variables:
|
||||
if var == SystemVariable.CONVERSATION:
|
||||
continue
|
||||
|
||||
cleaned_inputs['sys.' + var.value] = variable_pool.system_variables[var]
|
||||
|
||||
return NodeRunResult(
|
||||
status=WorkflowNodeExecutionStatus.SUCCEEDED,
|
||||
inputs=cleaned_inputs,
|
||||
|
|
|
|||
Loading…
Reference in New Issue