From a44e1488185e45eb31cf6f4cf036c1c971fdfcc2 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 12 Apr 2025 16:59:10 -0700 Subject: [PATCH] feat: Add go_ahead_tip and rename_with_shell to editblock prompts --- aider/coders/base_coder.py | 4 ++++ aider/coders/base_prompts.py | 3 +++ aider/coders/editblock_prompts.py | 14 +++++++++----- aider/coders/editor_editblock_prompts.py | 2 ++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 19d375afb..675570c60 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1091,11 +1091,13 @@ class Coder: if self.suggest_shell_commands: shell_cmd_prompt = self.gpt_prompts.shell_cmd_prompt.format(platform=platform_text) shell_cmd_reminder = self.gpt_prompts.shell_cmd_reminder.format(platform=platform_text) + rename_with_shell = self.gpt_prompts.rename_with_shell else: shell_cmd_prompt = self.gpt_prompts.no_shell_cmd_prompt.format(platform=platform_text) shell_cmd_reminder = self.gpt_prompts.no_shell_cmd_reminder.format( platform=platform_text ) + rename_with_shell = "" if self.chat_language: language = self.chat_language @@ -1115,7 +1117,9 @@ class Coder: lazy_prompt=lazy_prompt, platform=platform_text, shell_cmd_prompt=shell_cmd_prompt, + rename_with_shell=rename_with_shell, shell_cmd_reminder=shell_cmd_reminder, + go_ahead_tip=self.gpt_prompts.go_ahead_tip, language=language, ) diff --git a/aider/coders/base_prompts.py b/aider/coders/base_prompts.py index af1d3af3c..464212031 100644 --- a/aider/coders/base_prompts.py +++ b/aider/coders/base_prompts.py @@ -53,3 +53,6 @@ Do not edit these files! shell_cmd_reminder = "" no_shell_cmd_prompt = "" no_shell_cmd_reminder = "" + + rename_with_shell = "" + go_ahead_tip = "" diff --git a/aider/coders/editblock_prompts.py b/aider/coders/editblock_prompts.py index d183b0ab5..1457e021e 100644 --- a/aider/coders/editblock_prompts.py +++ b/aider/coders/editblock_prompts.py @@ -181,14 +181,17 @@ 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 -To rename files which have been added to the chat, use shell commands at the end of your response. +{rename_with_shell}{go_ahead_tip}{lazy_prompt}ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! +{shell_cmd_reminder} +""" -If the user just says something like "ok" or "go ahead" or "do that" they probably want you to make SEARCH/REPLACE blocks for the code changes you just proposed. + rename_with_shell = """To rename files which have been added to the chat, use shell commands at the end of your response. + +""" + + go_ahead_tip = """If the user just says something like "ok" or "go ahead" or "do that" they probably want you to make SEARCH/REPLACE blocks for the code changes you just proposed. The user will say when they've applied your edits. If they haven't explicitly confirmed the edits have been applied, they probably want proper SEARCH/REPLACE blocks. -{lazy_prompt} -ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! -{shell_cmd_reminder} """ shell_cmd_reminder = """ @@ -200,4 +203,5 @@ Examples of when to suggest shell commands: - Suggest OS-appropriate commands to delete or rename files/directories, or other file system operations. - If your code changes add new dependencies, suggest the command to install them. - Etc. + """ diff --git a/aider/coders/editor_editblock_prompts.py b/aider/coders/editor_editblock_prompts.py index 595e28bee..463075e2c 100644 --- a/aider/coders/editor_editblock_prompts.py +++ b/aider/coders/editor_editblock_prompts.py @@ -14,3 +14,5 @@ ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! shell_cmd_prompt = "" no_shell_cmd_prompt = "" shell_cmd_reminder = "" + go_ahead_tip = "" + rename_with_shell = ""