Fix : file agent loop problem

This commit is contained in:
martin legrand 2025-03-11 12:44:20 +01:00
parent 479bc2769b
commit cace6b5612
8 changed files with 7 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
media/whale_readme.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -3,10 +3,13 @@ from typing import Tuple, Callable
from abc import abstractmethod from abc import abstractmethod
import os import os
import random import random
import time
from sources.memory import Memory from sources.memory import Memory
from sources.utility import pretty_print from sources.utility import pretty_print
random.seed(time.time())
class executorResult: class executorResult:
""" """
A class to store the result of a tool execution. A class to store the result of a tool execution.
@ -106,7 +109,6 @@ class Agent():
if speech_module is None: if speech_module is None:
return return
messages = ["Please be patient sir, I am working on it.", messages = ["Please be patient sir, I am working on it.",
"At it, sir. In the meantime, how about a joke?",
"Computing... I recommand you have a coffee while I work.", "Computing... I recommand you have a coffee while I work.",
"Hold on, Im crunching numbers.", "Hold on, Im crunching numbers.",
"Working on it sir, please let me think."] "Working on it sir, please let me think."]

View File

@ -22,7 +22,6 @@ class CasualAgent(Agent):
def process(self, prompt, speech_module) -> str: def process(self, prompt, speech_module) -> str:
complete = False complete = False
exec_success = False
self.memory.push('user', prompt) self.memory.push('user', prompt)
self.wait_message(speech_module) self.wait_message(speech_module)

View File

@ -30,6 +30,10 @@ class FileAgent(Agent):
exec_success, _ = self.execute_modules(answer) exec_success, _ = self.execute_modules(answer)
answer = self.remove_blocks(answer) answer = self.remove_blocks(answer)
self.last_answer = answer self.last_answer = answer
complete = True
for name, tool in self.tools.items():
if tool.found_executable_blocks():
complete = False # AI read results and continue the conversation
return answer, reasoning return answer, reasoning
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -62,7 +62,6 @@ class FileFinder(Tools):
file_path = None file_path = None
excluded_files = [".pyc", ".o", ".so", ".a", ".lib", ".dll", ".dylib", ".so", ".git"] excluded_files = [".pyc", ".o", ".so", ".a", ".lib", ".dll", ".dylib", ".so", ".git"]
for root, dirs, files in os.walk(directory_path): for root, dirs, files in os.walk(directory_path):
print(f"Root: {root}, Files: {files}")
for file in files: for file in files:
if any(excluded_file in file for excluded_file in excluded_files): if any(excluded_file in file for excluded_file in excluded_files):
continue continue