Repository: Pythagora-io/gpt-pilot
File: pilot/helpers/agents/Developer.py (Python)

Code before:
                    "previous_solutions": llm_solutions,
                    "next_solution_to_try": next_solution_to_try,
                    "alternative_solutions_to_current_issue": alternative_solutions_to_current_issue,
                    "tried_alternative_solutions_to_current_issue": tried_alternative_solutions_to_current_issue,
                    "iteration_count": iteration_count,
                    "previous_features": self.project.previous_features,
                    "current_feature": self.project.current_feature,
                })

                llm_solutions.append({
                    "user_feedback": user_feedback,
                    "llm_proposal": iteration_description
                })

                instructions_prefix = " ".join(iteration_description.split()[:5])
                instructions_postfix = " ".join(iteration_description.split()[-5:])

                llm_response = iteration_convo.send_message('development/parse_task.prompt', {
                    'os': platform.system(),
                    'instructions_prefix': instructions_prefix,
                    'instructions_postfix': instructions_postfix,
                }, IMPLEMENT_TASK)
                iteration_convo.remove_last_x_messages(2)

                self.files_at_start_of_task = self.project.get_all_coded_files()
                task_steps = llm_response['tasks']
                self.execute_task(iteration_convo, task_steps, is_root_task=True, task_source='troubleshooting')
                print_task_progress(1, 1, development_task['description'], 'troubleshooting', 'done', len(llm_solutions) + 1)

    def bug_report_generator(self, user_feedback, task_review_description):
        """
        Generate a bug report from the user feedback.

        :param user_feedback: The user feedback.
        :param task_review_description: The task review description.
        :return: The user feedback and the questions and answers.
        """
        bug_report_convo = AgentConvo(self)
        function_uuid = str(uuid.uuid4())
        bug_report_convo.save_branch(function_uuid)
        questions_and_answers = []

        llm_response = bug_report_convo.send_message('development/bug_report.prompt', {
            "user_feedback": user_feedback,
            "app_summary": self.project.project_description,
            "files": self.project.get_all_coded_files(),
            "task_review_description": task_review_description,
            "questions_and_answers": questions_and_answers,
        }, GET_BUG_REPORT_MISSING_DATA)

        missing_data = llm_response['missing_data']

Review comment (suggestion):
Instead of getting last 3 here, now we send all of them and take last 3 inside `get_alternative_solutions.prompt`. Reason for that is that we are storing in db all data in column `prompt_data` and this way we will not store only last 3 but all previous llm_solutions so that i can access all of them when updating dev plan with `update_plan.prompt`

Code after:
                        if len(tried_alternative_solutions_to_current_issue) == 0:
                            tried_alternative_solutions_to_current_issue.append(description_of_tried_solutions)

                    tried_alternative_solutions_to_current_issue.append(next_solution_to_try)
                else:
                    user_feedback, user_feedback_qa = self.bug_report_generator(user_feedback, user_description)

                print_task_progress(1, 1, development_task['description'], 'troubleshooting', 'in_progress', len(llm_solutions) + 1)
                iteration_convo = AgentConvo(self)
                iteration_description = iteration_convo.send_message('development/iteration.prompt', {
                    "name": self.project.args['name'],
                    "app_type": self.project.args['app_type'],
                    "app_summary": self.project.project_description,
                    "user_stories": self.project.user_stories,
                    "user_tasks": self.project.user_tasks,
                    "architecture": self.project.architecture,
                    "technologies": self.project.system_dependencies + self.project.package_dependencies,
                    "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(relevant_files=self.relevant_files),
                    "file_summaries": self.project.get_file_summaries(),
                    "user_feedback": user_feedback,
                    "user_feedback_qa": user_feedback_qa,
                    "previous_solutions": llm_solutions,
                    "next_solution_to_try": next_solution_to_try,
                    "alternative_solutions_to_current_issue": alternative_solutions_to_current_issue,
                    "tried_alternative_solutions_to_current_issue": tried_alternative_solutions_to_current_issue,
                    "iteration_count": iteration_count,
                    "previous_features": self.project.previous_features,
                    "current_feature": self.project.current_feature,
                })

                llm_solutions.append({
                    "user_feedback": user_feedback,
                    "llm_proposal": iteration_description
                })

                instructions_prefix = " ".join(iteration_description.split()[:5])
                instructions_postfix = " ".join(iteration_description.split()[-5:])

                llm_response = iteration_convo.send_message('development/parse_task.prompt', {
                    'os': platform.system(),
                    'instructions_prefix': instructions_prefix,
                    'instructions_postfix': instructions_postfix,
                }, IMPLEMENT_TASK)
                iteration_convo.remove_last_x_messages(2)

                self.files_at_start_of_task = self.project.get_all_coded_files()
                task_steps = llm_response['tasks']