hadadrjt commited on
Commit
5b745df
·
1 Parent(s): bb7f36d
Files changed (1) hide show
  1. jarvis.py +3 -1
jarvis.py CHANGED
@@ -235,6 +235,7 @@ async def fetch_response_stream_async(host, key, model, msgs, cfg, sid, stop_eve
235
 
236
  async def chat_with_model_async(history, user_input, model_display, sess, custom_prompt):
237
  ensure_stop_event(sess)
 
238
  if not get_available_items(LINUX_SERVER_PROVIDER_KEYS, LINUX_SERVER_PROVIDER_KEYS_MARKED) or not get_available_items(LINUX_SERVER_HOSTS, LINUX_SERVER_HOSTS_ATTEMPTS):
239
  yield ("content", RESPONSES["RESPONSE_3"])
240
  return
@@ -348,7 +349,8 @@ def stop_response(history, sess):
348
  sess.stop_event.set()
349
  if history:
350
  history[-1][1] = RESPONSES["RESPONSE_1"]
351
- return history, gr.update(value="", interactive=True, submit_btn=True, stop_btn=False), sess
 
352
 
353
  with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], head=META_TAGS) as jarvis:
354
  user_history = gr.State([])
 
235
 
236
  async def chat_with_model_async(history, user_input, model_display, sess, custom_prompt):
237
  ensure_stop_event(sess)
238
+ sess.stop_event.clear()
239
  if not get_available_items(LINUX_SERVER_PROVIDER_KEYS, LINUX_SERVER_PROVIDER_KEYS_MARKED) or not get_available_items(LINUX_SERVER_HOSTS, LINUX_SERVER_HOSTS_ATTEMPTS):
240
  yield ("content", RESPONSES["RESPONSE_3"])
241
  return
 
349
  sess.stop_event.set()
350
  if history:
351
  history[-1][1] = RESPONSES["RESPONSE_1"]
352
+ new_sess = create_session()
353
+ return history, None, new_sess
354
 
355
  with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], head=META_TAGS) as jarvis:
356
  user_history = gr.State([])