hadadrjt commited on
Commit
a2b346b
·
1 Parent(s): c27c217

ai: Set custom clear logic.

Browse files
Files changed (1) hide show
  1. jarvis.py +3 -0
jarvis.py CHANGED
@@ -374,6 +374,9 @@ with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], h
374
  def on_example_select(evt: gr.SelectData):
375
  return evt.value
376
  chatbot.example_select(fn=on_example_select, inputs=[], outputs=[msg]).then(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, J_A_R_V_I_S], outputs=[chatbot, msg, user_session])
 
 
 
377
  msg.submit(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, J_A_R_V_I_S], outputs=[chatbot, msg, user_session], api_name=INTERNAL_AI_GET_SERVER)
378
  msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
379
  jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")
 
374
  def on_example_select(evt: gr.SelectData):
375
  return evt.value
376
  chatbot.example_select(fn=on_example_select, inputs=[], outputs=[msg]).then(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, J_A_R_V_I_S], outputs=[chatbot, msg, user_session])
377
+ def clear_chat():
378
+ return [], create_session(), "", "", []
379
+ chatbot.clear(fn=clear_chat, inputs=[], outputs=[chatbot, user_session, J_A_R_V_I_S, msg, user_history])
380
  msg.submit(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, J_A_R_V_I_S], outputs=[chatbot, msg, user_session], api_name=INTERNAL_AI_GET_SERVER)
381
  msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
382
  jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")