feat : improve planner agent handling of multifiles project

This commit is contained in:
martin legrand
2025-04-07 12:02:01 +02:00
parent 416d9d00ad
commit a1e71fd0ce
6 changed files with 29 additions and 10 deletions
+1
View File
@@ -297,6 +297,7 @@ class BrowserAgent(Agent):
unvisited = [None]
while not complete:
answer, reasoning = self.llm_decide(prompt, show_reasoning = False)
pretty_print(''*32, color="status")
extracted_form = self.extract_form(answer)
if len(extracted_form) > 0:
+3 -1
View File
@@ -37,9 +37,11 @@ class PlannerAgent(Agent):
lines = text.strip().split('\n')
for line in lines:
if line is None or len(line) == 0:
if line is None:
continue
line = line.strip()
if len(line) == 0:
continue
if '##' in line or line[0].isdigit():
tasks_names.append(line)
continue
+1
View File
@@ -40,6 +40,7 @@ class BashInterpreter(Tools):
concat_output = ""
for command in commands:
command = f"cd {self.work_dir} && {command}"
command = command.replace('\n', '')
if self.safe_mode and is_unsafe(commands):
return "Unsafe command detected, execution aborted."
+3 -3
View File
@@ -34,12 +34,12 @@ class Tools():
self.client = None
self.messages = []
self.config = configparser.ConfigParser()
self.current_dir = self.create_work_dir()
self.work_dir = self.create_work_dir()
self.excutable_blocks_found = False
self.safe_mode = True
def get_work_dir(self):
return self.current_dir
return self.work_dir
def check_config_dir_validity(self):
"""Check if the config directory is valid."""
@@ -116,7 +116,7 @@ class Tools():
return
save_path_dir = os.path.dirname(save_path)
save_path_file = os.path.basename(save_path)
directory = os.path.join(self.current_dir, save_path_dir)
directory = os.path.join(self.work_dir, save_path_dir)
if directory and not os.path.exists(directory):
os.makedirs(directory)
for block in blocks: