mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 09:19:23 +01:00
UI: Fix the chat "stop" event
This commit is contained in:
parent
9e82f8c394
commit
f32d26240d
@ -26,8 +26,7 @@ from modules.logging_colors import logger
|
|||||||
from modules.text_generation import (
|
from modules.text_generation import (
|
||||||
generate_reply,
|
generate_reply,
|
||||||
get_encoded_length,
|
get_encoded_length,
|
||||||
get_max_prompt_length,
|
get_max_prompt_length
|
||||||
stop_everything_event
|
|
||||||
)
|
)
|
||||||
from modules.utils import delete_file, get_available_characters, save_file
|
from modules.utils import delete_file, get_available_characters, save_file
|
||||||
|
|
||||||
@ -1036,13 +1035,6 @@ def handle_remove_last_click(state):
|
|||||||
return [history, html, last_input]
|
return [history, html, last_input]
|
||||||
|
|
||||||
|
|
||||||
def handle_stop_click(state):
|
|
||||||
stop_everything_event()
|
|
||||||
html = redraw_html(state['history'], state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
|
|
||||||
|
|
||||||
return html
|
|
||||||
|
|
||||||
|
|
||||||
def handle_unique_id_select(state):
|
def handle_unique_id_select(state):
|
||||||
history = load_history(state['unique_id'], state['character_menu'], state['mode'])
|
history = load_history(state['unique_id'], state['character_menu'], state['mode'])
|
||||||
html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
|
html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])
|
||||||
|
@ -7,6 +7,7 @@ from PIL import Image
|
|||||||
|
|
||||||
from modules import chat, shared, ui, utils
|
from modules import chat, shared, ui, utils
|
||||||
from modules.html_generator import chat_html_wrapper
|
from modules.html_generator import chat_html_wrapper
|
||||||
|
from modules.text_generation import stop_everything_event
|
||||||
from modules.utils import gradio
|
from modules.utils import gradio
|
||||||
|
|
||||||
inputs = ('Chat input', 'interface_state')
|
inputs = ('Chat input', 'interface_state')
|
||||||
@ -221,8 +222,8 @@ def create_event_handlers():
|
|||||||
chat.handle_remove_last_click, gradio('interface_state'), gradio('history', 'display', 'textbox'), show_progress=False)
|
chat.handle_remove_last_click, gradio('interface_state'), gradio('history', 'display', 'textbox'), show_progress=False)
|
||||||
|
|
||||||
shared.gradio['Stop'].click(
|
shared.gradio['Stop'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
stop_everything_event, None, None, queue=False).then(
|
||||||
chat.handle_stop_click, gradio('interface_state'), gradio('display'), show_progress=False)
|
chat.redraw_html, gradio(reload_arr), gradio('display'))
|
||||||
|
|
||||||
if not shared.args.multi_user:
|
if not shared.args.multi_user:
|
||||||
shared.gradio['unique_id'].select(
|
shared.gradio['unique_id'].select(
|
||||||
|
Loading…
Reference in New Issue
Block a user