From b34e343535ecae00cf0477969da29d45773763d6 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Sun, 30 Mar 2025 17:38:22 +0200 Subject: [PATCH] fix : possible crash with planner agent if wrong format returned by llm --- sources/agents/planner_agent.py | 2 ++ sources/browser.py | 1 - sources/router.py | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/agents/planner_agent.py b/sources/agents/planner_agent.py index 3da54f2..035405e 100644 --- a/sources/agents/planner_agent.py +++ b/sources/agents/planner_agent.py @@ -74,6 +74,8 @@ class PlannerAgent(Agent): def show_plan(self, json_plan): agents_tasks = self.parse_agent_tasks(json_plan) + if agents_tasks == (None, None): + return pretty_print(f"--- Plan ---", color="output") for task_name, task in agents_tasks: pretty_print(f"{task}", color="output") diff --git a/sources/browser.py b/sources/browser.py index a64e5d9..b6f7651 100644 --- a/sources/browser.py +++ b/sources/browser.py @@ -155,7 +155,6 @@ class Browser: for element in soup(['script', 'style']): element.decompose() - text = soup.get_text() lines = (line.strip() for line in text.splitlines()) chunks = (phrase.strip() for line in lines for phrase in line.split(" ")) diff --git a/sources/router.py b/sources/router.py index 8356570..1f11604 100644 --- a/sources/router.py +++ b/sources/router.py @@ -2,7 +2,6 @@ import os import sys import torch from transformers import pipeline -# adaptive-classifier==0.0.10 from adaptive_classifier import AdaptiveClassifier sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))