update alternative solutions when user is stuck in a loop

This commit is contained in:
LeonOstrez
2024-05-09 09:00:50 +01:00
parent 9eba9cff2d
commit d9ac194730
5 changed files with 25 additions and 30 deletions

View File

@@ -1090,9 +1090,13 @@ class Developer(Agent):
"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(),
"files": self.project.get_all_coded_files(relevant_files=self.relevant_files),
"file_summaries": self.project.get_file_summaries(),
"user_input": user_feedback,
"previous_solutions": previous_solutions,
# TODO tried_alternative_solutions_to_current_issue is not used in prompt anymore because in case multiple
# different issues are being solved, LLM gets confused and doesn't know which one to focus on. Long term
# solution is to know when issues is solved and then clear tried_alternative_solutions_to_current_issue.
"tried_alternative_solutions_to_current_issue": tried_alternative_solutions_to_current_issue,
"previous_features": self.project.previous_features,
"current_feature": self.project.current_feature,

View File

@@ -7,7 +7,9 @@ Here is a high level description of "{{ name }}":
{{ features_list }}
You are currently working on, and have to focus only on, this task:
`{{ current_task.description }}`
```
{{ current_task.description }}
```
A part of the app is already finished. Here is the list of files and descriptions that the app currently contains:
{% for fpath, summary in file_summaries.items() %}

View File

@@ -5,36 +5,20 @@ Here is a high level description of "{{ name }}":
{{ app_summary }}
```
{{ features_list }}
Project architecture:
{{ architecture }}
Here are the technologies that you need to use for this project:
{% for tech in technologies %}
* {{ tech["name"] }} - {{ tech["description"] }}{% endfor %}
{% 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 %}
{% if current_task %}
You are currently working on, and have to focus only on, this task:
```
{{ current_task.description }}
```
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.
{{ files_list }}
You are trying to solve an issue that your colleague is reporting. You tried {{ previous_solutions|length }} times to solve it but it was unsuccessful.
{% if tried_alternative_solutions_to_current_issue|length > 0 %}
Here are the alternative solutions that you tried to solve the issue:
{% for solution in tried_alternative_solutions_to_current_issue %}
----------------------------start_of_solution_{{ loop.index }}----------------------------
{{ solution }}
----------------------------end_of_solution_{{ loop.index }}----------------------------
{% endfor %}
{% elif previous_solutions|length > 0 %}
First time, your colleague gave you this report:
You are trying to solve an issue that your colleague is reporting.
{% if previous_solutions|length > 0 %}
You tried {{ previous_solutions|length }} times to solve it but it was unsuccessful. In last few attempts, your colleague gave you this report:
{% for solution in previous_solutions[-3:] %}
----------------------------start_of_report_{{ loop.index }}----------------------------
{{ solution['user_feedback'] }}
@@ -52,7 +36,7 @@ Then, upon implementing these changes, your colleague came back with the followi
{% endif %}
{% if user_input != '' %}
After implementing these changes as well, your colleague who is testing the app "{{ name }}" sent you this report now:
Your colleague who is testing the app "{{ name }}" sent you this report now:
```
{{ user_input }}
```
@@ -62,9 +46,8 @@ You tried to solve this problem before but your colleague is telling you that yo
It seems that the solutions you're proposing aren't working.
Now, think about 5 alternative solutions to get this code to work that are most probable to solve this issue.
Now, think step by step about 5 alternative solutions to get this code to work that are most probable to solve this issue.
Every proposed solution needs to be concrete and not vague (eg, it cannot be "Review and change apps functionality") and based on the code changes. A solution can be complex if it's related to the same part of the code (eg. "Try changing the input variables X, Y and Z to a method N").
Order them in the order of the biggest probability of fixing the problem. A developer will then go through this list item by item, try to implement it, and check if it solved the issue until the end of the list.
Let's think step by step.

View File

@@ -18,7 +18,10 @@ Development process of this app was split into smaller tasks. Here is the list o
{{ loop.index }}. {{ task['description'] }}
{% endfor %}
```
You are currently working on task "{{ current_task.description }}" and you have to focus only on that task.
You are currently working on, and have to focus only on, this task:
```
{{ current_task.description }}
```
{% endif %}
A part of the app is already finished.

View File

@@ -10,7 +10,10 @@ Development process of this app was split into smaller tasks. Here is the list o
{{ loop.index }}. {{ task['description'] }}
{% endfor %}
```
You are currently working on task "{{ current_task }}" and you have to focus only on that task.
You are currently working on, and have to focus only on, this task:
```
{{ current_task }}
```
A part of the app is already finished.
{{ files_list }}