From 1d8b44e1a699329c5e725e7ac223e2d13047881e Mon Sep 17 00:00:00 2001 From: user Date: Mon, 23 Dec 2024 14:10:54 -0500 Subject: [PATCH] Improve interruption UX. --- ra_aid/tools/human.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ra_aid/tools/human.py b/ra_aid/tools/human.py index f604642..1946ffe 100644 --- a/ra_aid/tools/human.py +++ b/ra_aid/tools/human.py @@ -1,3 +1,4 @@ +import sys from langchain_core.tools import tool from prompt_toolkit import PromptSession from prompt_toolkit.key_binding import KeyBindings @@ -16,6 +17,13 @@ def create_keybindings(): """Trigger submission when Ctrl+D is pressed.""" event.current_buffer.validate_and_handle() + @bindings.add('c-c') + def exit(event): + """Trigger exit when Ctrl+C is pressed.""" + print() + print(" 👋 Bye!") + sys.exit(0) + return bindings @tool