fixup! ai: Set custom clear logic.
Browse files
jarvis.py
CHANGED
|
@@ -357,9 +357,9 @@ with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], h
|
|
| 357 |
def on_example_select(evt: gr.SelectData):
|
| 358 |
return evt.value
|
| 359 |
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])
|
| 360 |
-
def clear_chat():
|
| 361 |
-
return [], create_session(),
|
| 362 |
-
chatbot.clear(fn=clear_chat, inputs=[], outputs=[chatbot, user_session, J_A_R_V_I_S,
|
| 363 |
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, show_progress="full", show_progress_on=[chatbot, msg])
|
| 364 |
msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
|
| 365 |
jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")
|
|
|
|
| 357 |
def on_example_select(evt: gr.SelectData):
|
| 358 |
return evt.value
|
| 359 |
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])
|
| 360 |
+
def clear_chat(history, sess, prompt, model):
|
| 361 |
+
return [], create_session(), prompt, model, []
|
| 362 |
+
chatbot.clear(fn=clear_chat, inputs=[user_history, user_session, J_A_R_V_I_S, selected_model], outputs=[chatbot, user_session, J_A_R_V_I_S, selected_model, user_history])
|
| 363 |
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, show_progress="full", show_progress_on=[chatbot, msg])
|
| 364 |
msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
|
| 365 |
jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")
|