From 8ce94b735c120ae73d3e2227c33bc856ee252983 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:22:53 -0700 Subject: [PATCH] Show progress on impersonate --- modules/chat.py | 9 ++++++--- modules/ui_chat.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index a3d0d6e8..37fa25f3 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -266,18 +266,21 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess def impersonate_wrapper(text, state): + + static_output = chat_html_wrapper(state['history'], state['name1'], state['name2'], state['mode'], state['chat_style']) + if shared.model_name == 'None' or shared.model is None: logger.error("No model is loaded! Select one in the Model tab.") - yield '' + yield '', static_output return prompt = generate_chat_prompt('', state, impersonate=True) stopping_strings = get_stopping_strings(state) - yield text + '...' + yield text + '...', static_output reply = None for reply in generate_reply(prompt + text, state, stopping_strings=stopping_strings, is_chat=True): - yield (text + reply).lstrip(' ') + yield (text + reply).lstrip(' '), static_output if shared.stop_everything: return diff --git a/modules/ui_chat.py b/modules/ui_chat.py index d16df842..cc2ef941 100644 --- a/modules/ui_chat.py +++ b/modules/ui_chat.py @@ -166,7 +166,7 @@ def create_event_handlers(): shared.gradio['Impersonate'].click( ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then( lambda x: x, gradio('textbox'), gradio('Chat input'), show_progress=False).then( - chat.impersonate_wrapper, gradio(inputs), gradio('textbox'), show_progress=False).then( + chat.impersonate_wrapper, gradio(inputs), gradio('textbox', 'display'), show_progress=False).then( ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then( lambda: None, None, None, _js=f'() => {{{ui.audio_notification_js}}}')