Bläddra i källkod

Remove redundant events

oobabooga 2 år sedan
förälder
incheckning
2f16d0afca
1 ändrade filer med 2 tillägg och 7 borttagningar
  1. 2 7
      server.py

+ 2 - 7
server.py

@@ -397,20 +397,15 @@ def create_interface():
             clear_arr = [shared.gradio[k] for k in ['Clear history-confirm', 'Clear history', 'Clear history-cancel']]
             reload_inputs = [shared.gradio[k] for k in ['name1', 'name2', 'Chat mode']]
 
-            def set_chat_input(textbox):
-                return textbox, ""
-
             gen_events.append(shared.gradio['Generate'].click(
-                set_chat_input, shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then(
+                lambda x : (x, ''), shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then(
                 chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream).then(
-                lambda x: '', shared.gradio['textbox'], shared.gradio['textbox'], show_progress=False).then(
                 lambda: chat.save_history(timestamp=False), [], [], show_progress=False)
             )
 
             gen_events.append(shared.gradio['textbox'].submit(
-                set_chat_input, shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then(
+                lambda x : (x, ''), shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then(
                 chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream).then(
-                lambda x: '', shared.gradio['textbox'], shared.gradio['textbox'], show_progress=False).then(
                 lambda: chat.save_history(timestamp=False), [], [], show_progress=False)
             )