diff --git a/pilot/helpers/AgentConvo.py b/pilot/helpers/AgentConvo.py index e86cbea5a..cb9dc8a3c 100644 --- a/pilot/helpers/AgentConvo.py +++ b/pilot/helpers/AgentConvo.py @@ -190,8 +190,8 @@ def replace_files(self): def replace_file_content(self, message, file_path, new_content): escaped_file_path = re.escape(file_path) - # Escape any \U in the file path - escaped_file_path = escaped_file_path.replace("\\U", "\\\\U") + # Double escape backslashes in new_content + new_content = new_content.replace("\\", "\\\\") pattern = rf'\*\*{{ {escaped_file_path} }}\*\*\n```\n(.*?)\n```' diff --git a/pilot/helpers/agents/Developer.py b/pilot/helpers/agents/Developer.py index cdf5af374..5876dc493 100644 --- a/pilot/helpers/agents/Developer.py +++ b/pilot/helpers/agents/Developer.py @@ -251,7 +251,7 @@ def task_postprocessing(self, convo, development_task, continue_development, tas try: if continue_development: continue_description = detailed_user_review_goal if detailed_user_review_goal is not None else None - return self.continue_development(convo, last_branch_name, continue_description) + return self.continue_development(convo, last_branch_name, continue_description, development_task) except TooDeepRecursionError as e: logger.warning('Too deep recursion error. Call dev_help_needed() for human_intervention: %s', e.message) return self.dev_help_needed({"type": "human_intervention", "human_intervention_description": e.message}) @@ -383,7 +383,7 @@ def execute_task(self, convo, task_steps, test_command=None, reset_convo=True, convo.load_branch(function_uuid) return self.task_postprocessing(convo, development_task, continue_development, result, function_uuid) - def continue_development(self, iteration_convo, last_branch_name, continue_description=''): + def continue_development(self, iteration_convo, last_branch_name, continue_description='', development_task=None): while True: logger.info('Continue development, last_branch_name: %s', last_branch_name) iteration_convo.load_branch(last_branch_name) @@ -429,6 +429,8 @@ def continue_development(self, iteration_convo, last_branch_name, continue_descr "technologies": self.project.architecture, "array_of_objects_to_string": array_of_objects_to_string, # TODO check why is this here "directory_tree": self.project.get_directory_tree(True), + "current_task": development_task, + "development_tasks": self.project.development_plan, "files": self.project.get_all_coded_files(), "user_input": user_feedback, }) diff --git a/pilot/prompts/development/iteration.prompt b/pilot/prompts/development/iteration.prompt index 276a05934..030139843 100644 --- a/pilot/prompts/development/iteration.prompt +++ b/pilot/prompts/development/iteration.prompt @@ -10,7 +10,16 @@ Here are the technologies that you need to use for this project: - {{ tech }}{% endfor %} ``` -A big part of the app is already finished. Here are files that are currently implemented: +{% if development_tasks and current_task %} +Development process of this app was split into smaller tasks. Here is the list of all tasks: +```{% for task in development_tasks %} +- {{ loop.index }}. {{ task['description'] }} +{% endfor %} +``` +You are currently working on task "{{ current_task.description }}" and you have to focus only on that task. + +{% endif %} +A part of the app is already finished.Here are files that are currently implemented: {% for file in files %} **{{ file.path }}**: ``` @@ -25,7 +34,7 @@ Now, your colleague who is testing the app "{{ name }}" sent you some additional Can you debug this issue or implement changes to comply with the additional user input? -Tell me all the new code that needs to be written or modified to implement this app and have it fully working. You can count that the environment is set up previously and packages listed in files are installed so tell me only commands needed for installation of new dependencies. +Tell me all the new code that needs to be written or modified to implement current task and have it fully working. You can count that the environment is set up previously and packages listed in files are installed so tell me only commands needed for installation of new dependencies, if there are any. {# Do not leave any parts of the code to be written afterwards. Make sure that all the code you provide is working and does as outlined in the description area above. #}