mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-28 21:01:55 +08:00
fix: conditional node
This commit is contained in:
parent
b7f64b6fe1
commit
778efd4c87
@ -1,4 +1,4 @@
|
||||
"""
|
||||
"""
|
||||
Module for implementing the conditional node
|
||||
"""
|
||||
from typing import Optional, List
|
||||
@ -28,21 +28,11 @@ class ConditionalNode(BaseNode):
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
input: str,
|
||||
output: List[str],
|
||||
node_config: Optional[dict] = None,
|
||||
node_name: str = "GenerateAnswerCSV",
|
||||
):
|
||||
def __init__(self):
|
||||
"""
|
||||
Initializes the node with the key to check and the next node names based on the condition.
|
||||
|
||||
Args:
|
||||
key_name (str): The name of the key to check in the state.
|
||||
Initializes an empty ConditionalNode.
|
||||
"""
|
||||
|
||||
#super().__init__(node_name, "node", input, output, 2, node_config)
|
||||
|
||||
pass
|
||||
|
||||
def execute(self, state: dict) -> dict:
|
||||
"""
|
||||
@ -55,8 +45,4 @@ class ConditionalNode(BaseNode):
|
||||
str: The name of the next node to execute based on the presence of the key.
|
||||
"""
|
||||
|
||||
if self.key_name in state and len(state[self.key_name]) > 0:
|
||||
state["next_node"] = 0
|
||||
else:
|
||||
state["next_node"] = 1
|
||||
return state
|
||||
pass
|
||||
|
||||
Loading…
Reference in New Issue
Block a user