qwendashcoder commited on
Commit
f2bfcdc
·
verified ·
1 Parent(s): 47bdf5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -431,17 +431,32 @@ with gr.Blocks(title="NVIDIA AI Chat") as demo:
431
  token_display
432
  )
433
 
 
434
  msg.submit(
435
  handle_chat,
436
- [msg, chatbot, current_model, logged_in_username, user_chats_state, current_chat_title, mode_radio, auth_globals_state, file_upload, current_chat_context],
 
437
  chatbot
438
- ).then(lambda: "", None, msg)
439
-
 
 
 
 
 
 
440
  send_btn.click(
441
  handle_chat,
442
- [msg, chatbot, current_model, logged_in_username, user_chats_state, current_chat_title, mode_radio, auth_globals_state, file_upload, current_chat_context],
 
443
  chatbot
444
- ).then(lambda: "", None, msg)
 
 
 
 
 
 
445
 
446
  # File manager events
447
  add_files_btn.click(
 
431
  token_display
432
  )
433
 
434
+ # Send button + Enter
435
  msg.submit(
436
  handle_chat,
437
+ [msg, chatbot, current_model, logged_in_username, user_chats_state,
438
+ current_chat_title, mode_radio, auth_globals_state, file_upload, current_chat_context],
439
  chatbot
440
+ ).then(
441
+ lambda: "", None, msg # clear input box
442
+ ).then(
443
+ update_token_display,
444
+ [user_chats_state, current_chat_title],
445
+ token_display
446
+ )
447
+
448
  send_btn.click(
449
  handle_chat,
450
+ [msg, chatbot, current_model, logged_in_username, user_chats_state,
451
+ current_chat_title, mode_radio, auth_globals_state, file_upload, current_chat_context],
452
  chatbot
453
+ ).then(
454
+ lambda: "", None, msg
455
+ ).then(
456
+ update_token_display,
457
+ [user_chats_state, current_chat_title],
458
+ token_display
459
+ )
460
 
461
  # File manager events
462
  add_files_btn.click(