Merge pull request #915 from Pythagora-io/development

Development
This commit is contained in:
LeonOstrez
2024-05-06 22:04:23 +01:00
committed by GitHub
7 changed files with 20 additions and 69 deletions

View File

@@ -30,17 +30,12 @@ jobs:
matrix:
# Test latest and oldest supported Python releases
# See https://devguide.python.org/versions/
python-version: ['3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.12']
os: [ubuntu-latest, macos-12, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:

View File

@@ -363,14 +363,14 @@ UPDATE_DEVELOPMENT_PLAN = {
},
"plan": {
"type": "array",
"description": 'List of development tasks that still need to be done to implement the entire plan.',
"description": 'List of unfinished tasks.',
"items": {
"type": "object",
'description': 'Development task that needs to be implemented to finish the entire plan.',
'description': 'List of unfinished tasks.',
'properties': {
'description': {
'type': 'string',
'description': 'Very detailed description of the development task that needs to be done to implement the entire plan.',
'description': 'Detailed description of the unfinished development task.',
}
},
'required': ['description'],

View File

@@ -161,6 +161,10 @@ class Developer(Agent):
# we get here only after all tasks but last one are loaded, so this must be final task
if self.project.dev_steps_to_load and 'breakdown.prompt' in self.project.dev_steps_to_load[0]['prompt_path']:
instructions = self.project.dev_steps_to_load[0]['llm_response']['text']
files = self.project.dev_steps_to_load[0]['prompt_data']['files'] if 'files' in self.project.dev_steps_to_load[0]['prompt_data'] else set()
self.relevant_files = set()
for file in files:
self.relevant_files.add(os.path.join(file['path'], file['name']))
convo_dev_task.messages = self.project.dev_steps_to_load[0]['messages']
# remove breakdown from the head of dev_steps_to_load; if it's last, record it in checkpoint
self.project.cleanup_list('dev_steps_to_load', int(self.project.dev_steps_to_load[0]['id']) + 1)
@@ -245,10 +249,6 @@ class Developer(Agent):
# dev_steps_to_load; if it's last, record it in checkpoint
self.project.cleanup_list('dev_steps_to_load', max(id for id in ids if id is not None))
if self.relevant_files is None:
# Recompute relevant files after project load
self.relevant_files = self.filter_relevant_files(self.project.get_file_summaries(), current_task=development_task)
while True:
result = self.execute_task(convo_dev_task,
steps,
@@ -938,6 +938,7 @@ class Developer(Agent):
}, IMPLEMENT_TASK)
task_steps = llm_response['tasks']
review_convo.remove_last_x_messages(2)
result = self.execute_task(review_convo, task_steps, task_source='review')
return {
'success': result['success'] if 'success' in result else False,

View File

@@ -6,18 +6,10 @@ Here is a high level description of "{{ name }}":
```
{{ features_list }}
{% 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.
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.
The app currently contains the following files:
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() %}
* `{{ fpath }}`: {{ summary }}{% endfor %}
@@ -31,6 +23,9 @@ Focus on solving this issue in the following way:
{{ next_solution_to_try }}
```
{% endif %}
Now, before you can work on this, you need to select which files from the above list are relevant to this task. Output the relevant files in a JSON list.
**IMPORTANT**
The files necessary for a developer to understand, modify, implement, and test the current task are considered to be relevant files.
Your job is select which of existing files are relevant for the current task. From the above list of files that app currently contains, you have to select ALL files that are relevant to the current task. Think step by step of everything that has to be done in this task and which files contain needed information. If you are unsure if a file is relevant or not, it is always better to include it in the list of relevant files.
{{ relative_paths }}

View File

@@ -30,6 +30,6 @@ Write high-quality code, first organize it logically with clear, meaningful name
**IMPORTANT** Your reply MUST NOT omit any code in the new implementation or substitute anything with comments like `// .. rest of the code goes here ..` or `# insert existing code here`, because I will overwrite the existing file with the content you provide. Output ONLY the content for this file, without additional explanation, suggestions or notes. Your output MUST start with ``` and MUST end with ``` and include only the complete file contents.
**IMPORTANT** For hardcoded configuration values that the user needs to change, mark the line that needs user configuration with `INPUT_REQUIRED {config_description}` comment, where `config_description` is a description of the value that needs to be set by the user. Use appropriate syntax for comments in the file you're saving (for example `// INPUT_REQUIRED {config_description}` in JavaScript). NEVER ask the user to write code or provide implementation, even if the instructions suggest it! If the file type doesn't support comments (eg JSON), don't add any.
**IMPORTANT** When working with configuration files (e.g. config.json, .env,...), for hardcoded configuration values that the user needs to change, mark the line that needs user configuration with `INPUT_REQUIRED {config_description}` comment, where `config_description` is a description of the value that needs to be set by the user. Use appropriate syntax for comments in the file you're saving (for example `// INPUT_REQUIRED {config_description}` in JavaScript). NEVER ask the user to write code or provide implementation, even if the instructions suggest it! If the file type doesn't support comments (eg JSON), don't add any.
{{ logs_and_error_handling }}

View File

@@ -37,4 +37,4 @@ You need to think step by step what was done in last task and update development
As output you have to give 2 things:
1. Reword/update current task, "updated_current_task", if needed, based on what is implemented so far. Consider current task description, all iterations that were implemented during this task and all changes that were made to the code.
2. Give me updated list of tasks that still have to be implemented. Take into consideration all tasks in current development plan, previous tasks that were finished and everything that was implemented in this task. There should be minimum possible number of tasks that still have to be executed to finish the app. You must list only tasks that need implementation and were not done in scope of previous tasks or during iterations on current task.
2. Give me updated list of tasks that still have to be implemented. Take into consideration all tasks in current development plan, previous tasks that were finished and everything that was implemented in this task. There should be minimum possible number of tasks that still have to be executed to finish the app. You must list only tasks that need implementation and were not done in scope of previous tasks or during iterations on current task. Do not create new tasks, only remove tasks from list of tasks that still have to be implemented in case they were implemented during current task.

View File

@@ -48,41 +48,6 @@ def trace_code_event(name: str, data: dict):
def get_path_id():
return telemetry.telemetry_id
def ask_to_store_prompt(project, path_id):
init_prompt = project.main_prompt if project is not None and project.main_prompt else None
if init_prompt is None:
return
# Prepare the prompt data
telemetry_data = {
"pathId": path_id,
"event": "pilot-prompt",
"data": init_prompt
}
question = ('We would appreciate if you let us store your initial app prompt. If you are OK with that, please just '
'press ENTER')
try:
answer = ask_user(project, question, ignore_user_input_count=True, require_some_input=False)
if answer == '':
telemetry.set("initial_prompt", init_prompt)
response = requests.post("https://api.pythagora.io/telemetry", json=telemetry_data)
response.raise_for_status()
except requests.RequestException as err:
print(f"Failed to store prompt: {err}")
except KeyboardInterrupt:
pass
def ask_user_feedback(project, path_id, ask_feedback):
question = ('Were you able to create any app that works? Please write any feedback you have or just press ENTER to exit:')
feedback = None
if ask_feedback:
feedback = ask_user(project, question, ignore_user_input_count=True, require_some_input=False)
if feedback: # only send if user provided feedback
telemetry.set("user_feedback", feedback)
send_feedback(feedback, path_id)
def ask_user_email(project):
question = (
@@ -98,18 +63,13 @@ def ask_user_email(project):
pass
return False
def exit_gpt_pilot(project, ask_feedback=True):
terminate_running_processes()
# path_id = get_path_id()
if ask_feedback:
# ask_to_store_prompt(project, path_id)
ask_user_email(project)
# TODO: Turned off for now because we're asking for email, and we don't want to
# annoy people.
# ask_user_feedback(project, path_id, ask_feedback)
telemetry.set("num_commands", project.command_runs_count if project is not None else 0)
telemetry.set("num_inputs", project.user_inputs_count if project is not None else 0)