From 21bf224feff86263f005665aea56b3d6960a697a Mon Sep 17 00:00:00 2001 From: martin legrand Date: Mon, 7 Apr 2025 14:55:41 +0200 Subject: [PATCH] fix: browser bug --- llm_router/dl_safetensors.sh | 2 +- prompts/base/file_agent.txt | 1 + prompts/jarvis/file_agent.txt | 1 + sources/agents/browser_agent.py | 2 ++ sources/agents/planner_agent.py | 2 +- sources/tools/fileFinder.py | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/llm_router/dl_safetensors.sh b/llm_router/dl_safetensors.sh index e2bc4ab..7fd1a51 100755 --- a/llm_router/dl_safetensors.sh +++ b/llm_router/dl_safetensors.sh @@ -8,7 +8,7 @@ #!/bin/bash # Define the URL and filename -URL="https://huggingface.co/adaptive-classifier/llm_router/resolve/main/model.safetensors" +URL="https://huggingface.co/adaptive-classifier/llm-router/resolve/main/model.safetensors" FILENAME="model.safetensors" if [ ! -f "$FILENAME" ]; then diff --git a/prompts/base/file_agent.txt b/prompts/base/file_agent.txt index 32c2e73..eb3a746 100644 --- a/prompts/base/file_agent.txt +++ b/prompts/base/file_agent.txt @@ -43,6 +43,7 @@ rules: - You are forbidden to use command such as find or locate, use only file_finder for finding path. - Do not ever use editor such as vim or nano. - Make sure to always cd your work folder before executing commands, like cd && +- only use file name with file_finder, not path Example Interaction User: "I need to find the file config.txt and read its contents." diff --git a/prompts/jarvis/file_agent.txt b/prompts/jarvis/file_agent.txt index 2ad4c3c..e6373d4 100644 --- a/prompts/jarvis/file_agent.txt +++ b/prompts/jarvis/file_agent.txt @@ -53,6 +53,7 @@ rules: - You are forbidden to use command such as find or locate, use only file_finder for finding path. - Make sure to always cd your work folder before executing commands, like cd && - Do not ever use editor such as vim or nano. +- only use file name with file_finder, not path Example Interaction User: "I need to find the file config.txt and read its contents." diff --git a/sources/agents/browser_agent.py b/sources/agents/browser_agent.py index b3dd1d5..0acc920 100644 --- a/sources/agents/browser_agent.py +++ b/sources/agents/browser_agent.py @@ -311,6 +311,8 @@ class BrowserAgent(Agent): links = self.parse_answer(answer) link = self.select_link(links) self.search_history.append(link) + hist = '\n'.join([x for x in self.search_history if x is not None]) + pretty_print(hist, color="warning") if "REQUEST_EXIT" in answer: pretty_print(f"Agent requested exit.", color="status") diff --git a/sources/agents/planner_agent.py b/sources/agents/planner_agent.py index d65b67b..82731aa 100644 --- a/sources/agents/planner_agent.py +++ b/sources/agents/planner_agent.py @@ -83,7 +83,7 @@ class PlannerAgent(Agent): def show_plan(self, json_plan: dict) -> None: agents_tasks = self.parse_agent_tasks(json_plan) if agents_tasks == (None, None): - pretty_print("Failed to make a plan.", color="failure") + pretty_print("Failed to make a plan. This can happen with (too) small LLM. Clarify your request and insist on it making a plan.", color="failure") return pretty_print("\nā–‚ā–˜ P L A N ā–ā–‚", color="status") for task_name, task in agents_tasks: diff --git a/sources/tools/fileFinder.py b/sources/tools/fileFinder.py index 273356c..000d29b 100644 --- a/sources/tools/fileFinder.py +++ b/sources/tools/fileFinder.py @@ -85,7 +85,7 @@ class FileFinder(Tools): results = [] for block in blocks: filename = block.split(":")[0] - file_path = self.recursive_search(self.current_dir, filename) + file_path = self.recursive_search(self.work_dir, filename) if file_path is None: results.append({"filename": filename, "error": "File not found"}) continue