mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 03:35:00 +00:00
feat: add shell command suggestion toggle and related prompts
This commit is contained in:
parent
304566a914
commit
d2379a6d73
3 changed files with 26 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue