refactor: Handle KeyboardInterrupt with user-assistant message pair and add env check for sanity_check_messages

This commit is contained in:
Paul Gauthier 2025-01-22 09:02:45 -08:00
parent 843720a671
commit 42ef4352f4
2 changed files with 7 additions and 3 deletions

View file

@ -1359,8 +1359,10 @@ class Coder:
interrupted = True
if interrupted:
content += "\n^C KeyboardInterrupt"
self.cur_messages += [dict(role="assistant", content=content)]
self.cur_messages += [
dict(role="user", content="^C KeyboardInterrupt"),
dict(role="assistant", content="I see that you interrupted my previous reply."),
]
return
edited = self.apply_updates()