| @@ -22,7 +22,7 @@ from core.model_runtime.utils.encoders import jsonable_encoder | |||
| from core.prompt.advanced_prompt_transform import AdvancedPromptTransform | |||
| from core.prompt.entities.advanced_prompt_entities import CompletionModelPromptTemplate, MemoryConfig | |||
| from core.prompt.utils.prompt_message_util import PromptMessageUtil | |||
| from core.variables import ArrayAnySegment, ArrayFileSegment, FileSegment | |||
| from core.variables import ArrayAnySegment, ArrayFileSegment, FileSegment, NoneSegment | |||
| from core.workflow.constants import SYSTEM_VARIABLE_NODE_ID | |||
| from core.workflow.entities.node_entities import NodeRunMetadataKey, NodeRunResult | |||
| from core.workflow.enums import SystemVariableKey | |||
| @@ -320,11 +320,12 @@ class LLMNode(BaseNode[LLMNodeData]): | |||
| variable_selectors = variable_template_parser.extract_variable_selectors() | |||
| for variable_selector in variable_selectors: | |||
| variable_value = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector) | |||
| if variable_value is None: | |||
| variable = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector) | |||
| if variable is None: | |||
| raise ValueError(f"Variable {variable_selector.variable} not found") | |||
| inputs[variable_selector.variable] = variable_value.to_object() | |||
| if isinstance(variable, NoneSegment): | |||
| continue | |||
| inputs[variable_selector.variable] = variable.to_object() | |||
| memory = node_data.memory | |||
| if memory and memory.query_prompt_template: | |||
| @@ -332,11 +333,12 @@ class LLMNode(BaseNode[LLMNodeData]): | |||
| template=memory.query_prompt_template | |||
| ).extract_variable_selectors() | |||
| for variable_selector in query_variable_selectors: | |||
| variable_value = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector) | |||
| if variable_value is None: | |||
| variable = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector) | |||
| if variable is None: | |||
| raise ValueError(f"Variable {variable_selector.variable} not found") | |||
| inputs[variable_selector.variable] = variable_value.to_object() | |||
| if isinstance(variable, NoneSegment): | |||
| continue | |||
| inputs[variable_selector.variable] = variable.to_object() | |||
| return inputs | |||