diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index cface7d72..e66cd6fef 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -923,10 +923,21 @@ class Coder: lazy_prompt = self.gpt_prompts.lazy_prompt if self.main_model.lazy else "" platform_text = self.get_platform_info() + 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) + 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 + ) + prompt = prompt.format( fence=self.fence, lazy_prompt=lazy_prompt, platform=platform_text, + shell_cmd_prompt=shell_cmd_prompt, + shell_cmd_reminder=shell_cmd_reminder, ) return prompt diff --git a/aider/coders/base_prompts.py b/aider/coders/base_prompts.py index d4e91b5e0..7e07a4f54 100644 --- a/aider/coders/base_prompts.py +++ b/aider/coders/base_prompts.py @@ -43,3 +43,8 @@ If you need to edit any of these files, ask me to *add them to the chat* first. read_only_files_prefix = """Here are some READ ONLY files, provided for your reference. Do not edit these files! """ + + shell_cmd_prompt = "" + shell_cmd_reminder = "" + no_shell_cmd_prompt = "" + no_shell_cmd_reminder = "" diff --git a/aider/coders/editblock_prompts.py b/aider/coders/editblock_prompts.py index 072e78a24..4d3502521 100644 --- a/aider/coders/editblock_prompts.py +++ b/aider/coders/editblock_prompts.py @@ -27,7 +27,10 @@ You can keep asking if you then decide you need to edit more files. All changes to files must use this *SEARCH/REPLACE block* format. ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! +{shell_cmd_prompt} +""" + shell_cmd_prompt = """ 4. *Concisely* suggest any shell commands the user might want to run in ```bash blocks. Just suggest shell commands this way, not example code. @@ -36,7 +39,6 @@ Only suggest at most a few shell commands at a time, not more than 1-3. Use the appropriate shell based on the user's system info: {platform} - Examples of when to suggest shell commands: - If you changed a self-contained html file, suggest an OS-appropriate command to open a browser to view it to see the updated content. @@ -47,6 +49,10 @@ Examples of when to suggest shell commands: - Etc. """ + no_shell_cmd_prompt = """ +Keep in mind these details about the user's platform and environment: +{platform} +""" example_messages = [ dict( role="user", @@ -176,7 +182,10 @@ To rename files which have been added to the chat, use shell commands at the end {lazy_prompt} ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! +{shell_cmd_reminder} +""" + shell_cmd_reminder = """ Examples of when to suggest shell commands: - If you changed a self-contained html file, suggest an OS-appropriate command to open a browser to view it to see the updated content.