mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-02 09:26:09 +01:00
Fixed code changes prompt for Code Monkey
This commit is contained in:
@@ -178,6 +178,52 @@ DEV_STEPS = {
|
||||
},
|
||||
}
|
||||
|
||||
CODE_CHANGES = {
|
||||
'definitions': [
|
||||
{
|
||||
'name': 'break_down_development_task',
|
||||
'description': 'Implements all the smaller tasks that need to be done to complete the entire development task.',
|
||||
'parameters': {
|
||||
'type': 'object',
|
||||
"properties": {
|
||||
"tasks": {
|
||||
'type': 'array',
|
||||
'description': 'List of smaller development steps that need to be done to complete the entire task.',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'description': 'A smaller development step that needs to be done to complete the entire task. Remember, if you need to run a command that doesnt\'t finish by itself (eg. a command to run an app), put the timeout to 3 seconds.',
|
||||
'properties': {
|
||||
'type': {
|
||||
'type': 'string',
|
||||
'enum': ['command', 'code_change'],
|
||||
'description': 'Type of the development step that needs to be done to complete the entire task - it can be "command" or "code_change".',
|
||||
},
|
||||
'command': {
|
||||
'type': 'string',
|
||||
'description': 'Command that needs to be run to complete the current task. This should be used only if the task is of a type "command".',
|
||||
},
|
||||
'command_timeout': {
|
||||
'type': 'number',
|
||||
'description': 'Timeout in seconds that represent the approximate time the command takes to finish. This should be used only if the task is of a type "command". If you need to run a command that doesnt\'t finish by itself (eg. a command to run an app), put the timeout to 3 seconds.',
|
||||
},
|
||||
'code_change_description': {
|
||||
'type': 'string',
|
||||
'description': 'Description of a the development step that needs to be done. This should be used only if the task is of a type "code_change" and it should thoroughly describe what needs to be done to implement the code change.',
|
||||
},
|
||||
},
|
||||
'required': ['type'],
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ['tasks'],
|
||||
},
|
||||
}
|
||||
],
|
||||
'functions': {
|
||||
'break_down_development_task': lambda tasks: tasks,
|
||||
},
|
||||
}
|
||||
|
||||
DEVELOPMENT_PLAN = {
|
||||
'definitions': [{
|
||||
'name': 'implement_development_plan',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from const.function_calls import GET_FILES, DEV_STEPS, IMPLEMENT_CHANGES
|
||||
from const.function_calls import GET_FILES, DEV_STEPS, IMPLEMENT_CHANGES, CODE_CHANGES
|
||||
from helpers.files import update_file
|
||||
from helpers.cli import run_command_until_success
|
||||
from helpers.cli import build_directory_tree
|
||||
@@ -12,10 +12,11 @@ class CodeMonkey(Agent):
|
||||
|
||||
def implement_code_changes(self, code_changes_description):
|
||||
convo = AgentConvo(self)
|
||||
steps, type = convo.send_message('development/task/break_down_code_changes.prompt', {
|
||||
steps = convo.send_message('development/task/break_down_code_changes.prompt', {
|
||||
"instructions": code_changes_description,
|
||||
"directory_tree": self.project.get_directory_tree(),
|
||||
}, DEV_STEPS)
|
||||
"technologies": self.project.architecture
|
||||
}, CODE_CHANGES)
|
||||
|
||||
|
||||
convo.save_branch('after_code_changes_breakdown')
|
||||
|
||||
@@ -8,6 +8,13 @@ Here is the current folder tree:
|
||||
{{ directory_tree }}
|
||||
```
|
||||
|
||||
Here are technologies that you can use:
|
||||
```
|
||||
{% for technology in technologies %}
|
||||
- {{ technology }}
|
||||
{% endfor %}
|
||||
```
|
||||
|
||||
First, you need to break down these instructions into actionable steps that can be made. There are 2 types of steps. If a step requires a change in a file content, that step is of a type `code_change` and if a change requires a command to be run (eg. to create a file or a folder), that step is of a type `run_command`.
|
||||
For a step to be actionable, it cannot have a vague description but a clear explanation of what needs to be done to finish that step. Here are a couple of examples of good and bad steps:
|
||||
BAD STEP: `Set up mongo database`
|
||||
@@ -17,4 +24,6 @@ When thinking about steps, first think about what files need to changed to finis
|
||||
|
||||
So, each step of type `code_change` can contain ALL changes that need to be made to a single file. If changes need to be made to multiple different files, they need to be split across multiple steps where each step contains all changes that need ot be made to a single file.
|
||||
|
||||
Remember, all commands will be run from the project root folder.
|
||||
|
||||
Now, think step by step and return a list of steps that need to be run.
|
||||
Reference in New Issue
Block a user