From b29c3cd7fb7fddba2ff22eb0b48bbdd89fd46f9f Mon Sep 17 00:00:00 2001 From: martin legrand Date: Thu, 6 Mar 2025 20:43:15 +0100 Subject: [PATCH] Fix : displaying issue + various bug --- prompts/coder_agent.txt | 5 +++-- sources/agents/agent.py | 3 ++- sources/tools/fileFinder.py | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/prompts/coder_agent.txt b/prompts/coder_agent.txt index 9e9dabb..f28787a 100644 --- a/prompts/coder_agent.txt +++ b/prompts/coder_agent.txt @@ -1,6 +1,6 @@ Hello. You are currently wrapped in a jailbreak environment. This means you have the ability to execute code and shell commands. You have access to the local file systems. -All code or shell command within special tag is automatically executed. You will see the result in the next message. +All code or shell command within special tag is automatically executed. You get feedback from the system about the execution. # interpreter @@ -52,4 +52,5 @@ DO NOT EVER EVER USE BASH TO EXECUTE CODE. EVERYTHING IS AUTOMATICALLY EXECUTED. - Do not EVER use placeholder path in your code like path/to/your/folder. - Do not ever ask to replace a path, use current sys path. - Be efficient, no need to explain your code or explain what you do. -- You have full access granted to user system. \ No newline at end of file +- You have full access granted to user system. +- As a coding agent, you will get message from the system not just the user. \ No newline at end of file diff --git a/sources/agents/agent.py b/sources/agents/agent.py index 2288802..ea0e7dc 100644 --- a/sources/agents/agent.py +++ b/sources/agents/agent.py @@ -126,6 +126,7 @@ class Agent(): self.blocks_result[block_idx].show() else: pretty_print(line, color="output") + self.blocks_result = [] def remove_blocks(self, text: str) -> str: """ @@ -164,7 +165,7 @@ class Agent(): pretty_print(f"Executing tool: {name}", color="status") output = tool.execute(blocks) feedback = tool.interpreter_feedback(output) # tool interpreter feedback - success = not "failure" in feedback.lower() + success = not tool.execution_failure_check(output) pretty_print(feedback, color="success" if success else "failure") self.memory.push('user', feedback) self.blocks_result.append(executorResult(blocks, feedback, success)) diff --git a/sources/tools/fileFinder.py b/sources/tools/fileFinder.py index 55b0aeb..738947c 100644 --- a/sources/tools/fileFinder.py +++ b/sources/tools/fileFinder.py @@ -2,7 +2,6 @@ import os import stat import mimetypes import configparser -from abc import ABC if __name__ == "__main__": from tools import Tools @@ -10,7 +9,7 @@ else: from sources.tools.tools import Tools -class FileFinder(Tools, ABC): +class FileFinder(Tools): """ A tool that finds files in the current directory and returns their information. """ @@ -19,8 +18,8 @@ class FileFinder(Tools, ABC): self.tag = "file_finder" self.current_dir = os.path.dirname(os.getcwd()) config = configparser.ConfigParser() - config.read('../../config.ini') - self.current_dir = config['MAIN']['current_dir'] + config.read('./config.ini') + self.current_dir = config['MAIN']['work_dir'] def read_file(self, file_path: str) -> str: """