|
8 | 8 |
|
9 | 9 | from ..telemetry import log_graph_execution |
10 | 10 | from ..utils import CustomLLMCallbackManager |
| 11 | +from ..utils.logging import get_logger |
11 | 12 |
|
| 13 | +logger = get_logger(__name__) |
| 14 | + |
| 15 | +# ANSI escape sequence for hyperlink |
| 16 | +CLICKABLE_URL = "\033]8;;https://scrapegraphai.com\033\\https://scrapegraphai.com\033]8;;\033\\" |
12 | 17 |
|
13 | 18 | class BaseGraph: |
14 | 19 | """ |
@@ -353,9 +358,24 @@ def execute(self, initial_state: dict) -> Tuple[dict, list]: |
353 | 358 |
|
354 | 359 | bridge = BurrBridge(self, self.burr_config) |
355 | 360 | result = bridge.execute(initial_state) |
356 | | - return (result["_state"], []) |
| 361 | + state, exec_info = (result["_state"], []) |
357 | 362 | else: |
358 | | - return self._execute_standard(initial_state) |
| 363 | + state, exec_info = self._execute_standard(initial_state) |
| 364 | + |
| 365 | + # Print the result first |
| 366 | + if "answer" in state: |
| 367 | + print(state["answer"]) |
| 368 | + elif "parsed_doc" in state: |
| 369 | + print(state["parsed_doc"]) |
| 370 | + elif "generated_code" in state: |
| 371 | + print(state["generated_code"]) |
| 372 | + elif "merged_script" in state: |
| 373 | + print(state["merged_script"]) |
| 374 | + |
| 375 | + # Then show the message ONLY ONCE |
| 376 | + print(f"✨ Try enhanced version of ScrapegraphAI at {CLICKABLE_URL} ✨") |
| 377 | + |
| 378 | + return state, exec_info |
359 | 379 |
|
360 | 380 | def append_node(self, node): |
361 | 381 | """ |
|
0 commit comments