mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
Add a "/chat <question>" command that passes the question to a ChatCoder and integrates the resulting messages into the main chat history.
This commit is contained in:
parent
3d603f3579
commit
bc73832d0d
1 changed files with 24 additions and 0 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue