mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
better prompting for LLM to suggest files
This commit is contained in:
parent
e96420f999
commit
6638efbee4
5 changed files with 12 additions and 6 deletions
|
@ -448,7 +448,10 @@ class Coder:
|
|||
files_reply = "Ok, any changes I propose will be to those files."
|
||||
elif repo_content:
|
||||
files_content = self.gpt_prompts.files_no_full_files_with_repo_map
|
||||
files_reply = "Ok, based on your requests I will suggest which files need to be edited."
|
||||
files_reply = (
|
||||
"Ok, based on your requests I will suggest which files need to be edited and then"
|
||||
" stop and wait for your approval."
|
||||
)
|
||||
else:
|
||||
files_content = self.gpt_prompts.files_no_full_files
|
||||
files_reply = "Ok."
|
||||
|
|
|
@ -20,7 +20,8 @@ You always COMPLETELY IMPLEMENT the needed code!
|
|||
|
||||
files_no_full_files = "I am not sharing any files that you can edit yet."
|
||||
|
||||
files_no_full_files_with_repo_map = """Tell me which files in my repo are the most likely to **need changes** to solve the requests I make.
|
||||
files_no_full_files_with_repo_map = """Don't try and edit any existing code without asking me to add the files to the chat!
|
||||
Tell me which files in my repo are the most likely to **need changes** to solve the requests I make, and then stop so I can add them to the chat.
|
||||
Only include the 1-2 files that are most likely to actually need to be edited.
|
||||
Don't include files that might contain relevant context, just files that will need to be changed.
|
||||
""" # noqa: E501
|
||||
|
|
|
@ -478,7 +478,7 @@ Hope you like it!
|
|||
print(list(find_original_update_blocks(edit)))
|
||||
|
||||
|
||||
def find_similar_lines(search_lines, content_lines, threshold=0.9):
|
||||
def find_similar_lines(search_lines, content_lines, threshold=0.8):
|
||||
search_lines = search_lines.splitlines()
|
||||
content_lines = content_lines.splitlines()
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ If the request is ambiguous, ask questions.
|
|||
Always reply to the user in the same language they are using.
|
||||
|
||||
Once you understand the request you MUST:
|
||||
1. List the files you need to modify. Only suggest changes to files that the user says you can edit. Before changing other files, you *MUST* tell the user their full path names and ask them to *add the files to the chat*. End your reply and wait for their approval.
|
||||
1. Decide if you need to propose *SEARCH/REPLACE* edits to any files that haven't been added to the chat. You can create new files without asking. But if you need to propose edits to existing files not already added to the chat, you *MUST* tell the user their full path names and ask them to *add the files to the chat*. End your reply and wait for their approval. You can keep asking if you then decide you need to edit more files.
|
||||
2. Think step-by-step and explain the needed changes with a numbered list of short sentences.
|
||||
3. Describe each change with a *SEARCH/REPLACE block* per the examples below. All changes to files must use this *SEARCH/REPLACE block* format. ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*!
|
||||
|
||||
|
@ -126,7 +126,7 @@ Every *SEARCH* section must *EXACTLY MATCH* the existing source code, character
|
|||
|
||||
Include *ALL* the code being searched and replaced!
|
||||
|
||||
Only *SEARCH/REPLACE* files that the user says you can edit.
|
||||
Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat!
|
||||
|
||||
To move code within a file, use 2 *SEARCH/REPLACE* blocks: 1 to delete it from its current location, 1 to insert it in the new location.
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@ undo_command_reply = (
|
|||
" why the changes were reverted."
|
||||
)
|
||||
|
||||
added_files = "I added these files to the chat: {fnames}"
|
||||
added_files = """I added these files to the chat: {fnames}.
|
||||
|
||||
If you need to propose edits to other existing files not already added to the chat, you *MUST* tell the me their full path names and ask me to *add the files to the chat*. End your reply and wait for my approval. You can keep asking if you then decide you need to edit more files."""
|
||||
|
||||
|
||||
run_output = """I ran this command:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue