From d87310ad612d1c4ff5943aa0a703267fad208aff Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:40:22 -0300 Subject: [PATCH] Send last input to the input box when "Remove last" is clicked --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 1ee7cd28..a5600d51 100644 --- a/server.py +++ b/server.py @@ -336,12 +336,12 @@ if args.chat or args.cai_chat: yield i def remove_last_message(name1, name2): - history.pop() + last = history.pop() _history = remove_example_dialogue_from_history(history) if args.cai_chat: - return generate_chat_html(_history, name1, name2, character) + return generate_chat_html(_history, name1, name2, character), last[0] else: - return _history + return _history, last[0] def clear(): global history @@ -471,7 +471,7 @@ if args.chat or args.cai_chat: gen_event3 = btn_regenerate.click(regenerate_wrapper, input_params, display1, show_progress=args.no_stream) btn_clear.click(clear) - btn_remove_last.click(remove_last_message, [name1, name2], display1, show_progress=False) + btn_remove_last.click(remove_last_message, [name1, name2], [display1, textbox], show_progress=False) btn.click(lambda x: "", textbox, textbox, show_progress=False) btn_regenerate.click(lambda x: "", textbox, textbox, show_progress=False) textbox.submit(lambda x: "", textbox, textbox, show_progress=False)