From 29eb2f468183bc7cc5faf2c3d9c0339dc8076e19 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 23 Apr 2024 14:06:08 -0700 Subject: [PATCH] seems to work better --- aider/coders/base_coder.py | 5 +++-- aider/coders/editblock_prompts.py | 33 +++++++++++++------------------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index daaa5fc7e..812a1efd9 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -513,10 +513,11 @@ class Coder: total_tokens = 0 messages += self.cur_messages + messages[-1]["content"] += "\n\n" + self.fmt_system_prompt(self.gpt_prompts.system_reminder) # Add the reminder prompt if we still have room to include it. - if total_tokens < self.main_model.info.get("max_input_tokens", 0): - messages += reminder_message + # if total_tokens < self.main_model.info.get("max_input_tokens", 0): + # messages += reminder_message return messages diff --git a/aider/coders/editblock_prompts.py b/aider/coders/editblock_prompts.py index 896670d1f..66c3883be 100644 --- a/aider/coders/editblock_prompts.py +++ b/aider/coders/editblock_prompts.py @@ -5,9 +5,6 @@ from .base_prompts import CoderPrompts class EditBlockPrompts(CoderPrompts): main_system = """Act as an expert software developer. -You are diligent and tireless! -You NEVER leave comments describing code without implementing it! -You always COMPLETELY IMPLEMENT the needed code! Always use best practices when coding. Respect and use existing conventions, libraries, etc that are already present in the code base. @@ -17,16 +14,15 @@ If the request is ambiguous, ask questions. Once you understand the request you MUST: 1. List the files you need to modify. Only suggest changes to a *read-write* files. Before changing *read-only* 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. 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. +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*! -All changes to files must use this *SEARCH/REPLACE block* format. -# Example conversation 1: +# Example conversation: ## USER: These are the *read-write* files: +{fence[0]} mathweb/flask/app.py -{fence[0]}python from flask import Flask app = Flask(__name__) @@ -70,8 +66,8 @@ Do make this change we need to modify `mathweb/flask/app.py` to: Here are the *SEARCH/REPLACE* blocks: +{fence[0]} mathweb/flask/app.py -{fence[0]}python <<<<<<< SEARCH from flask import Flask ======= @@ -80,8 +76,8 @@ from flask import Flask >>>>>>> REPLACE {fence[1]} +{fence[0]} mathweb/flask/app.py -{fence[0]}python <<<<<<< SEARCH def factorial(n): "compute factorial" @@ -95,8 +91,8 @@ def factorial(n): >>>>>>> REPLACE {fence[1]} +{fence[0]} mathweb/flask/app.py -{fence[0]}python <<<<<<< SEARCH return str(factorial(n)) ======= @@ -104,12 +100,13 @@ mathweb/flask/app.py >>>>>>> REPLACE {fence[1]} -# Example conversation 2: + +# Example conversation: ## USER: These are the *read-write* files: +{fence[0]} main.py -{fence[0]}python def hello(): "print a greeting" @@ -132,8 +129,8 @@ Do make this change we need to modify `main.py` and make a new file `hello.py`: Here are the *SEARCH/REPLACE* blocks: +{fence[0]} hello.py -{fence[0]}python <<<<<<< SEARCH ======= def hello(): @@ -143,8 +140,8 @@ def hello(): >>>>>>> REPLACE {fence[1]} +{fence[0]} main.py -{fence[0]}python <<<<<<< SEARCH def hello(): "print a greeting" @@ -159,8 +156,8 @@ from hello import hello """ system_reminder = """Every *SEARCH/REPLACE block* must use this format: -1. The file path alone on a line, eg: main.py -2. The opening fence and code language, eg: {fence[0]}python +1. The opening fence and code language, eg: {fence[0]} +2. The file path alone on a line, eg: main.py 3. The start of search block: <<<<<<< SEARCH 4. A contiguous chunk of lines to search for in the existing source code 5. The dividing line: ======= @@ -181,9 +178,7 @@ If you want to put code in a new file, use a *SEARCH/REPLACE block* with: - An empty `SEARCH` section - The new file's contents in the `REPLACE` section -You are diligent and tireless! -You NEVER leave comments describing code without implementing it! -You always COMPLETELY IMPLEMENT the needed code! +ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! """ files_content_prefix = "These are the *read-write* files:\n"