Add AskCoder functionality to handle user questions about the codebase

This commit is contained in:
Your Name 2024-07-28 19:02:27 -03:00 committed by Your Name (aider)
parent f44347e72d
commit 69af6f8ab5
3 changed files with 9 additions and 11 deletions

View file

@ -7,7 +7,7 @@ from .single_wholefile_func_coder import SingleWholeFileFunctionCoder
from .udiff_coder import UnifiedDiffCoder
from .wholefile_coder import WholeFileCoder
from .wholefile_func_coder import WholeFileFunctionCoder
from .chat_coder import ChatCoder
from .ask_coder import AskCoder
__all__ = [
Coder,
@ -19,5 +19,5 @@ __all__ = [
SingleWholeFileFunctionCoder,
UnifiedDiffCoder,
HelpCoder,
ChatCoder,
AskCoder,
]

View file

@ -4,9 +4,9 @@ from aider import diffs
from ..dump import dump # noqa: F401
from .base_coder import Coder
from .chat_prompts import ChatPrompts
from .ask_prompts import AskPrompts
class ChatCoder(Coder):
edit_format = "chat"
gpt_prompts = ChatPrompts()
class AskCoder(Coder):
edit_format = "ask"
gpt_prompts = AskPrompts()

View file

@ -701,7 +701,6 @@ class Commands:
self.help = Help()
coder = Coder.create(
main_model=self.coder.main_model,
io=self.io,
from_coder=self.coder,
edit_format="help",
@ -723,8 +722,8 @@ class Commands:
dict(role="assistant", content=assistant_msg),
]
def cmd_chat(self, args):
"Chat with the AI about the current project"
def cmd_ask(self, args):
"Ask questions about the code base without editing any files"
if not args.strip():
self.io.tool_error("Please provide a question or topic for the chat.")
@ -733,10 +732,9 @@ class Commands:
from aider.coders import Coder
chat_coder = Coder.create(
main_model=self.coder.main_model,
io=self.io,
from_coder=self.coder,
edit_format="chat",
edit_format="ask",
summarize_from_coder=False,
)