chansung commited on
Commit
55c7341
β€’
1 Parent(s): 66e51ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -377,21 +377,27 @@ with gr.Blocks(css="constants/styles.css", theme=gr.themes.Soft()) as demo:
377
  )
378
 
379
  chat_button.click(None, [cur_arxiv_id], [local_data, chatbot], js=OPEN_CHAT_IF)
380
- close.click(None, None, None,js=CLOSE_CHAT_IF)
381
 
382
- prompt_txtbox.submit(
383
  before_chat_begin, None, [close, reset, regen],
384
  concurrency_limit=20,
385
- ).then(
 
 
386
  chat_stream,
387
  [cur_arxiv_id, local_data, prompt_txtbox, chat_state],
388
  [prompt_txtbox, chatbot, local_data, close, reset, regen],
389
  concurrency_limit=20,
390
- ).then(
 
 
391
  None, [cur_arxiv_id, local_data], None,
392
  js=UPDATE_CHAT_HISTORY
393
  )
394
 
 
 
395
  reset.click(
396
  before_chat_begin, None, [close, reset, regen],
397
  concurrency_limit=20,
 
377
  )
378
 
379
  chat_button.click(None, [cur_arxiv_id], [local_data, chatbot], js=OPEN_CHAT_IF)
380
+ close.click(None, None, None,js=CLOSE_CHAT_IF)
381
 
382
+ chat_event = prompt_txtbox.submit(
383
  before_chat_begin, None, [close, reset, regen],
384
  concurrency_limit=20,
385
+ )
386
+
387
+ chat_event2 = chat_event.then(
388
  chat_stream,
389
  [cur_arxiv_id, local_data, prompt_txtbox, chat_state],
390
  [prompt_txtbox, chatbot, local_data, close, reset, regen],
391
  concurrency_limit=20,
392
+ )
393
+
394
+ chat_event3 = chat_event2.then(
395
  None, [cur_arxiv_id, local_data], None,
396
  js=UPDATE_CHAT_HISTORY
397
  )
398
 
399
+ close.click(None, None, None, cancels=[chat_event, chat_event2, chat_event3])
400
+
401
  reset.click(
402
  before_chat_begin, None, [close, reset, regen],
403
  concurrency_limit=20,