mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: improve keyboard interrupt message handling
This commit is contained in:
parent
491fb14eaa
commit
162204f28f
1 changed files with 5 additions and 4 deletions
|
@ -1367,10 +1367,11 @@ class Coder:
|
|||
interrupted = True
|
||||
|
||||
if interrupted:
|
||||
# check if the last messages was role==user, append the ^C Key.. to it if so. ai!
|
||||
self.cur_messages += [
|
||||
dict(role="user", content="^C KeyboardInterrupt"),
|
||||
dict(role="assistant", content="I see that you interrupted my previous reply."),
|
||||
if self.cur_messages and self.cur_messages[-1]["role"] == "user":
|
||||
self.cur_messages[-1]["content"] += "\n^C KeyboardInterrupt"
|
||||
else:
|
||||
self.cur_messages += [dict(role="user", content="^C KeyboardInterrupt")]
|
||||
self.cur_messages += [dict(role="assistant", content="I see that you interrupted my previous reply.")]
|
||||
]
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue