From 0e89ff4b1340048591c5bdee397a4c26b4aad7b3 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:49:52 -0300 Subject: [PATCH] Clear the persistent history after clicking on "Clear history" --- server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index fec9d710..b8d6aa59 100644 --- a/server.py +++ b/server.py @@ -884,7 +884,7 @@ if args.chat or args.cai_chat: with gr.Row(): buttons["Impersonate"] = gr.Button("Impersonate") buttons["Remove last"] = gr.Button("Remove last") - buttons["Clear"] = gr.Button("Clear history") + buttons["Clear history"] = gr.Button("Clear history") with gr.Row(): buttons["Send last reply to input"] = gr.Button("Send last reply to input") buttons["Replace last reply"] = gr.Button("Replace last reply") @@ -951,7 +951,7 @@ if args.chat or args.cai_chat: buttons["Send last reply to input"].click(send_last_reply_to_input, [], textbox, show_progress=args.no_stream) buttons["Replace last reply"].click(replace_last_reply, [textbox, name1, name2], display, show_progress=args.no_stream) - buttons["Clear"].click(clear_chat_log, [character_menu, name1, name2], display) + buttons["Clear history"].click(clear_chat_log, [character_menu, name1, name2], display) buttons["Remove last"].click(remove_last_message, [name1, name2], [display, textbox], show_progress=False) buttons["Download"].click(save_history, inputs=[], outputs=[download]) buttons["Upload character"].click(upload_character, [upload_char, upload_img], [character_menu]) @@ -960,6 +960,7 @@ if args.chat or args.cai_chat: for i in ["Generate", "Regenerate", "Replace last reply"]: buttons[i].click(lambda x: "", textbox, textbox, show_progress=False) buttons[i].click(lambda : save_history(timestamp=False), [], [], show_progress=False) + buttons["Clear history"].click(lambda : save_history(timestamp=False), [], [], show_progress=False) textbox.submit(lambda x: "", textbox, textbox, show_progress=False) textbox.submit(lambda : save_history(timestamp=False), [], [], show_progress=False)