From 69af6f8ab5b725eb796d0524264cfe64dd841945 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 28 Jul 2024 19:02:27 -0300 Subject: [PATCH] Add AskCoder functionality to handle user questions about the codebase --- aider/coders/__init__.py | 4 ++-- aider/coders/{chat_coder.py => ask_coder.py} | 8 ++++---- aider/commands.py | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) rename aider/coders/{chat_coder.py => ask_coder.py} (50%) diff --git a/aider/coders/__init__.py b/aider/coders/__init__.py index 863a5d1b6..2633961b1 100644 --- a/aider/coders/__init__.py +++ b/aider/coders/__init__.py @@ -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, ] diff --git a/aider/coders/chat_coder.py b/aider/coders/ask_coder.py similarity index 50% rename from aider/coders/chat_coder.py rename to aider/coders/ask_coder.py index c035c790f..72ff8bd3f 100644 --- a/aider/coders/chat_coder.py +++ b/aider/coders/ask_coder.py @@ -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() diff --git a/aider/commands.py b/aider/commands.py index a5a91e0f7..c4951fe71 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -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, )