mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
feat: Add /copy command to copy last assistant message to clipboard
This commit is contained in:
parent
7c1318274e
commit
0c470662bb
1 changed files with 15 additions and 0 deletions
|
@ -1158,6 +1158,21 @@ class Commands:
|
|||
settings = format_settings(self.parser, self.args)
|
||||
self.io.tool_output(settings)
|
||||
|
||||
def cmd_copy(self, args):
|
||||
"Copy the last assistant message to the clipboard"
|
||||
all_messages = self.coder.done_messages + self.coder.cur_messages
|
||||
assistant_messages = [msg for msg in reversed(all_messages) if msg['role'] == 'assistant']
|
||||
|
||||
if not assistant_messages:
|
||||
self.io.tool_error("No assistant messages found to copy.")
|
||||
return
|
||||
|
||||
last_assistant_message = assistant_messages[0]['content']
|
||||
pyperclip.copy(last_assistant_message)
|
||||
|
||||
preview = last_assistant_message[:50] + "..." if len(last_assistant_message) > 50 else last_assistant_message
|
||||
self.io.tool_output(f"Copied last assistant message to clipboard. Preview: {preview}")
|
||||
|
||||
def cmd_report(self, args):
|
||||
"Report a problem by opening a GitHub Issue"
|
||||
from aider.report import report_github_issue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue