Improve interruption UX.
This commit is contained in:
parent
34fcb76ad8
commit
1d8b44e1a6
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue