diff --git a/aider/commands.py b/aider/commands.py index 270cf7e83..e20fd0291 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -8,6 +8,7 @@ import git from aider import models, prompts, voice from aider.help import Help, install_help_extra +from aider.coders import ChatCoder from aider.llm import litellm from aider.scrape import Scraper, install_playwright from aider.utils import is_image_file @@ -723,6 +724,29 @@ class Commands: dict(role="assistant", content=assistant_msg), ] + def cmd_chat(self, args): + "Chat with the AI about the current project" + + if not args.strip(): + self.io.tool_error("Please provide a question or topic for the chat.") + return + + chat_coder = ChatCoder.create( + main_model=self.coder.main_model, + io=self.io, + from_coder=self.coder, + edit_format="whole", + summarize_from_coder=False, + ) + + user_msg = args + assistant_msg = chat_coder.run(user_msg) + + self.coder.cur_messages += [ + dict(role="user", content=user_msg), + dict(role="assistant", content=assistant_msg), + ] + def get_help_md(self): "Show help about all commands in markdown"