mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Add "remove last message" button to chat
This commit is contained in:
parent
fd220f827f
commit
13b04c1b94
11
server.py
11
server.py
@ -223,6 +223,10 @@ elif args.chat:
|
||||
history.append((text, reply))
|
||||
return history
|
||||
|
||||
def remove_last_message():
|
||||
history.pop()
|
||||
return history
|
||||
|
||||
def clear():
|
||||
global history
|
||||
history = []
|
||||
@ -257,10 +261,15 @@ elif args.chat:
|
||||
display1 = gr.Chatbot()
|
||||
textbox = gr.Textbox(lines=2, label='Input')
|
||||
btn = gr.Button("Generate")
|
||||
btn2 = gr.Button("Clear history")
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
btn3 = gr.Button("Remove last message")
|
||||
with gr.Column():
|
||||
btn2 = gr.Button("Clear history")
|
||||
|
||||
btn.click(chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True, api_name="textgen")
|
||||
textbox.submit(chatbot_wrapper, [textbox, length_slider, preset_menu, model_menu, name1, name2, context, check], display1, show_progress=True)
|
||||
btn3.click(remove_last_message, [], display1, show_progress=False)
|
||||
btn2.click(clear)
|
||||
btn.click(lambda x: "", textbox, textbox, show_progress=False)
|
||||
textbox.submit(lambda x: "", textbox, textbox, show_progress=False)
|
||||
|
Loading…
Reference in New Issue
Block a user