Skip to content

Python scraper based on AI

fix(deepcopy): switch whether we have obj in the config

Marco Perinid4d913c8a360
diff --git a/scrapegraphai/graphs/omni_search_graph.py b/scrapegraphai/graphs/omni_search_graph.py
index 49f75c08..c428fc98 100644
--- a/scrapegraphai/graphs/omni_search_graph.py
+++ b/scrapegraphai/graphs/omni_search_graph.py
@@ -2,7 +2,7 @@
OmniSearchGraph Module
"""
-from copy import copy
+from copy import copy, deepcopy
from .base_graph import BaseGraph
from ..nodes import (
@@ -43,7 +43,11 @@ class OmniSearchGraph(AbstractGraph):
def __init__(self, prompt: str, config: dict):
self.max_results = config.get("max_results", 3)
- self.copy_config = copy(config)
+
+ if all(isinstance(value, str) for value in config.values()):
+ self.copy_config = copy(config)
+ else:
+ self.copy_config = deepcopy(config)
super().__init__(prompt, config)
diff --git a/scrapegraphai/graphs/search_graph.py b/scrapegraphai/graphs/search_graph.py
index 6a46ab91..a9f2824a 100644
--- a/scrapegraphai/graphs/search_graph.py
+++ b/scrapegraphai/graphs/search_graph.py
@@ -2,7 +2,7 @@
SearchGraph Module
"""
-from copy import copy
+from copy import copy, deepcopy
from .base_graph import BaseGraph
from ..nodes import (
@@ -42,7 +42,11 @@ class SearchGraph(AbstractGraph):
def __init__(self, prompt: str, config: dict):
self.max_results = config.get("max_results", 3)
- self.copy_config = copy(config)
+
+ if all(isinstance(value, str) for value in config.values()):
+ self.copy_config = copy(config)
+ else:
+ self.copy_config = deepcopy(config)
super().__init__(prompt, config)