This commit is contained in:
Paul Gauthier 2024-07-04 16:06:12 -03:00
parent fceaa0504c
commit af48cc3e4c
7 changed files with 180 additions and 47 deletions

View file

@ -75,6 +75,7 @@ class Coder:
edit_format=None,
io=None,
from_coder=None,
summarize_from_coder=True,
**kwargs,
):
from . import (
@ -108,7 +109,7 @@ class Coder:
# confused the new LLM. It may try and imitate it, disobeying
# the system prompt.
done_messages = from_coder.done_messages
if edit_format != from_coder.edit_format and done_messages:
if edit_format != from_coder.edit_format and done_messages and summarize_from_coder:
done_messages = from_coder.summarizer.summarize_all(done_messages)
# Bring along context from the old Coder
@ -550,18 +551,16 @@ 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 and then"
" stop and wait for your approval."
)
files_reply = self.gpt_prompts.files_no_full_files_with_repo_map_reply
else:
files_content = self.gpt_prompts.files_no_full_files
files_reply = "Ok."
files_messages += [
dict(role="user", content=files_content),
dict(role="assistant", content=files_reply),
]
if files_content:
files_messages += [
dict(role="user", content=files_content),
dict(role="assistant", content=files_reply),
]
images_message = self.get_images_message()
if images_message is not None:
@ -734,7 +733,8 @@ class Coder:
example_messages = []
if self.main_model.examples_as_sys_msg:
main_sys += "\n# Example conversations:\n\n"
if self.gpt_prompts.example_messages:
main_sys += "\n# Example conversations:\n\n"
for msg in self.gpt_prompts.example_messages:
role = msg["role"]
content = self.fmt_system_prompt(msg["content"])

View file

@ -28,6 +28,11 @@ Only include the 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
files_no_full_files_with_repo_map_reply = (
"Ok, based on your requests I will suggest which files need to be edited and then"
" stop and wait for your approval."
)
repo_content_prefix = """Here are summaries of some files present in my git repository.
Do not propose changes to these files, treat them as *read-only*.
If you need to edit any of these files, ask me to *add them to the chat* first.

View file

@ -29,3 +29,15 @@ Unless the question indicates otherwise, assume the user wants to use aider as a
example_messages = []
system_reminder = ""
files_content_prefix = """These are some files we have been discussing that we may want to edit after you answer my questions:
"""
files_no_full_files = "I am not sharing any files with you."
files_no_full_files_with_repo_map = ""
files_no_full_files_with_repo_map_reply = ""
repo_content_prefix = """Here are summaries of some files present in my git repository.
We may look at these in more detail after you answer my questions.
"""