From 1403d19aa70b3190d66c364aa44fe9de02ed334f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 1 May 2024 09:34:40 -0700 Subject: [PATCH] Added example messages to wholefile edit format --- aider/coders/base_prompts.py | 2 ++ aider/coders/wholefile_prompts.py | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/aider/coders/base_prompts.py b/aider/coders/base_prompts.py index f95bc94dc..06f185eb6 100644 --- a/aider/coders/base_prompts.py +++ b/aider/coders/base_prompts.py @@ -8,3 +8,5 @@ class CoderPrompts: files_content_local_edits = "I edited the files myself." lazy_prompt = "" + + example_messages = [] diff --git a/aider/coders/wholefile_prompts.py b/aider/coders/wholefile_prompts.py index dda10fe3c..08bf17313 100644 --- a/aider/coders/wholefile_prompts.py +++ b/aider/coders/wholefile_prompts.py @@ -14,18 +14,43 @@ Once you understand the request you MUST: 3. If changes are needed, output a copy of each file that needs changes. """ + example_messages = [ + dict( + role="user", + content="Change the greeting to be more casual", + ), + dict( + role="assistant", + content="""Ok, I will: + +1. Switch the greeting text from "Hello" to "Hey". + +show_greeting.py +{fence[0]} +import sys + +def greeting(name): + print(f"Hey {name}") + +if __name__ == '__main__': + greeting(sys.argv[1]) +{fence[1]} +""", + ), + ] + system_reminder = """To suggest changes to a file you MUST return the entire content of the updated file. You MUST use this *file listing* format: path/to/filename.js -{fence[0]}javascript +{fence[0]} // entire file content ... // ... goes in between {fence[1]} Every *file listing* MUST use this format: - First line: the filename with any originally provided path -- Second line: opening {fence[0]} including the code language +- Second line: opening {fence[0]} - ... entire content of the file ... - Final line: closing {fence[1]}