mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
wip: Refactor prompts.py and coder.py to improve user experience.
This commit is contained in:
parent
d1e8ebfe04
commit
4eed5a1b90
3 changed files with 16 additions and 20 deletions
|
@ -315,7 +315,7 @@ class Coder:
|
||||||
for rel_fname in mentioned_rel_fnames:
|
for rel_fname in mentioned_rel_fnames:
|
||||||
self.io.tool(f"{rel_fname}")
|
self.io.tool(f"{rel_fname}")
|
||||||
|
|
||||||
if not self.io.confirm_ask("Add {path} to git?"):
|
if not self.io.confirm_ask(f"Add these files to the chat?"):
|
||||||
return
|
return
|
||||||
|
|
||||||
for rel_fname in mentioned_rel_fnames:
|
for rel_fname in mentioned_rel_fnames:
|
||||||
|
@ -404,10 +404,13 @@ class Coder:
|
||||||
self.io.tool_error(f"Skipping edit to {path}")
|
self.io.tool_error(f"Skipping edit to {path}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
Path(full_path).parent.mkdir(parents=True, exist_ok=True)
|
if not Path(full_path).exists():
|
||||||
Path(full_path).touch()
|
Path(full_path).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
Path(full_path).touch()
|
||||||
|
|
||||||
self.abs_fnames.add(full_path)
|
self.abs_fnames.add(full_path)
|
||||||
|
|
||||||
|
# TODO: check if it's already in the repo
|
||||||
if self.repo and self.io.confirm_ask(f"Add {path} to git?"):
|
if self.repo and self.io.confirm_ask(f"Add {path} to git?"):
|
||||||
self.repo.git.add(full_path)
|
self.repo.git.add(full_path)
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,9 @@ If the user's request is ambiguous, ask questions to fully understand.
|
||||||
|
|
||||||
Once you understand the user's request and can see all the relevant code, your responses MUST be:
|
Once you understand the user's request and can see all the relevant code, your responses MUST be:
|
||||||
|
|
||||||
1. First, think step-by-step.
|
1. Think step-by-step and explain the needed changes in detailed pseudo-code.
|
||||||
2. Explain the needed changes in detailed pseudo-code.
|
2. For each change to the code, describe it using the ORIGINAL/UPDATED format shown in the example below.
|
||||||
3. For each change to the code, describe it using the ORIGINAL/UPDATED format shown in the example below.
|
|
||||||
4. If the request requires many large changes, break them into smaller steps and pause to get feedback from the user.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
system_reminder = '''
|
system_reminder = '''
|
||||||
|
@ -47,11 +46,8 @@ some/dir/example.py
|
||||||
"""Multiplies 2 numbers"""
|
"""Multiplies 2 numbers"""
|
||||||
>>>>>>> UPDATED
|
>>>>>>> UPDATED
|
||||||
|
|
||||||
If need to see the contents of a file from the git repo, tell the user the file names you need!
|
|
||||||
Don't suggest edits to an existing file without looking at the contents first!
|
|
||||||
|
|
||||||
IF YOU WANT TO SUGGEST CODE THAT BELONGS IN A NEW FILE:
|
IF YOU WANT TO SUGGEST CODE THAT BELONGS IN A NEW FILE:
|
||||||
- MAKE UP A FILENAME FOR THE FILE
|
- MAKE UP A FILENAME FOR THE FILE, INCLUDING THE CORRECT DIRECTORY NAME
|
||||||
- REPLY WITH AN ORIGINAL/UPDATE BLOCK WITH THE NEW FILENAME INCLUDING DIRECTORIES
|
- REPLY WITH AN ORIGINAL/UPDATE BLOCK WITH THE NEW FILENAME INCLUDING DIRECTORIES
|
||||||
- INCLUDE AN EMPTY ORIGINAL BLOCK
|
- INCLUDE AN EMPTY ORIGINAL BLOCK
|
||||||
- PUT THE NEW FILE'S CONTENTS IN THE UPDATED BLOCK
|
- PUT THE NEW FILE'S CONTENTS IN THE UPDATED BLOCK
|
||||||
|
@ -61,6 +57,7 @@ IF YOU WANT TO SUGGEST CODE THAT BELONGS IN A NEW FILE:
|
||||||
|
|
||||||
EVERY ORIGINAL/UPDATED BLOCK MUST START WITH THE FILENAME!
|
EVERY ORIGINAL/UPDATED BLOCK MUST START WITH THE FILENAME!
|
||||||
EVERY ORIGINAL/UPDATED BLOCK MUST BE TRIPLE QUOTED!
|
EVERY ORIGINAL/UPDATED BLOCK MUST BE TRIPLE QUOTED!
|
||||||
|
AFTER THE OPENING TRIPLE-QUOTE, INDICATE THE LANGUAGE OF THE CODE.
|
||||||
|
|
||||||
THE ORIGINAL BLOCK MUST BE AN EXACT SEQUENCE OF LINES FROM THE FILE:
|
THE ORIGINAL BLOCK MUST BE AN EXACT SEQUENCE OF LINES FROM THE FILE:
|
||||||
- NEVER OMIT LINES!
|
- NEVER OMIT LINES!
|
||||||
|
@ -71,6 +68,8 @@ EVEN NEARBY PARTS NEED THEIR OWN ORIGINAL/UPDATED BLOCKS.
|
||||||
|
|
||||||
INCLUDE THE FILE PATH ALONE AS THE FIRST LINE OF THE BLOCK.
|
INCLUDE THE FILE PATH ALONE AS THE FIRST LINE OF THE BLOCK.
|
||||||
Don't prefix it with "In" or follow it with ":".
|
Don't prefix it with "In" or follow it with ":".
|
||||||
|
|
||||||
|
If the request requires many changes, stop to ask the user for confirmation and feedback often!
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,10 +93,11 @@ files_content_local_edits = "I made some changes to the files myself."
|
||||||
|
|
||||||
repo_content_prefix = "These are the files in the git repo:\n\n"
|
repo_content_prefix = "These are the files in the git repo:\n\n"
|
||||||
|
|
||||||
files_content_prefix = "Here is the current content of the files we have opened:\n\n"
|
files_content_prefix = "Here is the content of the files you are allowed to edit:\n\n"
|
||||||
|
|
||||||
files_content_suffix = (
|
files_content_suffix = (
|
||||||
"""Base any edits on the current contents of the files as shown in the user's last message."""
|
"""Base any edits on the current contents of the files as shown in the user's last message.
|
||||||
|
If you need to edit other files, ask first!"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,6 @@
|
||||||
# Aider modifying the 2048 game
|
# Aider modifying the 2048 game
|
||||||
> Here, we explore and modify the open source 2048 game codebase from https://github.com/gabrielecirulli/2048
|
> Here, we explore and modify the open source 2048 game codebase from https://github.com/gabrielecirulli/2048
|
||||||
|
|
||||||
---
|
|
||||||
#### > what is this?
|
|
||||||
|
|
||||||
This is an AI language model designed to help you with code-related tasks. You can ask me to help you with new features, improvements
|
|
||||||
|
|
||||||
_^C again to quit_
|
|
||||||
|
|
||||||
---
|
---
|
||||||
#### > what is this repo?
|
#### > what is this repo?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue