Skip to content

Commit a7db47e

Browse files
committed
refatoring
1 parent bd5b686 commit a7db47e

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

scrapegraphai/graphs/script_creator_multi_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ def run(self) -> str:
113113
"""
114114
inputs = {"user_prompt": self.prompt, "urls": self.source}
115115
self.final_state, self.execution_info = self.graph.execute(inputs)
116-
return self.final_state.get("merged_script", "Failed to generate the script.")
116+
return self.final_state.get("merged_script", "Failed to generate the script.")

scrapegraphai/graphs/search_link_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ def run(self) -> str:
101101
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
102102
self.final_state, self.execution_info = self.graph.execute(inputs)
103103

104-
return self.final_state.get("parsed_doc", "No answer found.")
104+
return self.final_state.get("parsed_doc", "No answer found.")

scrapegraphai/nodes/conditional_node.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""
22
Module for implementing the conditional node
33
"""
4-
4+
from typing import Optional, List
55
from .base_node import BaseNode
66

7-
87
class ConditionalNode(BaseNode):
98
"""
109
A node that determines the next step in the graph's execution flow based on
@@ -29,16 +28,21 @@ class ConditionalNode(BaseNode):
2928
3029
"""
3130

32-
def __init__(self, key_name: str, node_name="ConditionalNode"):
31+
def __init__(self,
32+
input: str,
33+
output: List[str],
34+
node_config: Optional[dict] = None,
35+
node_name: str = "GenerateAnswerCSV",
36+
):
3337
"""
3438
Initializes the node with the key to check and the next node names based on the condition.
3539
3640
Args:
3741
key_name (str): The name of the key to check in the state.
3842
"""
3943

40-
super().__init__(node_name, "conditional_node")
41-
self.key_name = key_name
44+
super().__init__(node_name, "node", input, output, 2, node_config)
45+
4246

4347
def execute(self, state: dict) -> dict:
4448
"""

scrapegraphai/nodes/generate_answer_csv_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
self.verbose = (
5959
False if node_config is None else node_config.get("verbose", False)
6060
)
61-
61+
6262
self.additional_info = node_config.get("additional_info")
6363

6464
def execute(self, state):

0 commit comments

Comments
 (0)