added HelpCoder

This commit is contained in:
Paul Gauthier 2024-07-04 14:29:19 -03:00
parent b3eb1dea49
commit 9f39c8db44
7 changed files with 150 additions and 119 deletions

View file

@ -2,6 +2,7 @@ from .base_coder import Coder
from .editblock_coder import EditBlockCoder
from .editblock_fenced_coder import EditBlockFencedCoder
from .editblock_func_coder import EditBlockFunctionCoder
from .help_coder import HelpCoder
from .single_wholefile_func_coder import SingleWholeFileFunctionCoder
from .udiff_coder import UnifiedDiffCoder
from .wholefile_coder import WholeFileCoder
@ -16,4 +17,5 @@ __all__ = [
EditBlockFunctionCoder,
SingleWholeFileFunctionCoder,
UnifiedDiffCoder,
HelpCoder,
]

View file

@ -80,6 +80,7 @@ class Coder:
from . import (
EditBlockCoder,
EditBlockFencedCoder,
HelpCoder,
UnifiedDiffCoder,
WholeFileCoder,
)
@ -130,6 +131,8 @@ class Coder:
res = WholeFileCoder(main_model, io, **kwargs)
elif edit_format == "udiff":
res = UnifiedDiffCoder(main_model, io, **kwargs)
elif edit_format == "help":
res = HelpCoder(main_model, io, **kwargs)
else:
raise ValueError(f"Unknown edit format {edit_format}")

View file

@ -0,0 +1,17 @@
from ..dump import dump # noqa: F401
from .base_coder import Coder
from .help_prompts import HelpPrompts
class HelpCoder(Coder):
edit_format = "help"
def __init__(self, *args, **kwargs):
self.gpt_prompts = HelpPrompts()
super().__init__(*args, **kwargs)
def get_edits(self, mode="update"):
return []
def apply_edits(self, edits):
pass

View file

@ -0,0 +1,31 @@
# flake8: noqa: E501
from .base_prompts import CoderPrompts
class HelpPrompts(CoderPrompts):
main_system = """You are an expert on the AI coding tool called Aider.
Answer the user's questions about how to use aider.
The user is currently chatting with you using aider, to write and edit code.
Use the provided aider documentation *if it is relevant to the user's question*.
Include a bulleted list of urls to the aider docs that might be relevant for the user to read.
Include *bare* urls. *Do not* make [markdown links](http://...).
For example:
- https://aider.chat/docs/usage.html
- https://aider.chat/docs/faq.html
If you don't know the answer, say so and suggest some relevant aider doc urls.
If asks for something that isn't possible with aider, be clear about that.
Don't suggest a solution that isn't supported.
Be helpful but concise.
Unless the question indicates otherwise, assume the user wants to use aider as a CLI tool.
"""
example_messages = []
system_reminder = ""