Tuchuanhuhuhu commited on
Commit
10cfc85
·
1 Parent(s): fce5dd0

minor: 删除历史记录时显示名称,空历史记录不弹窗

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +6 -5
ChuanhuChatbot.py CHANGED
@@ -434,12 +434,13 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
434
  )
435
  historyRefreshBtn.click(**refresh_history_args)
436
  historyDeleteBtn.click(delete_chat_history, [current_model, historyFileSelectDropdown, user_name], [status_display, historyFileSelectDropdown], _js='''function showConfirmationDialog(a, b, c) {
437
- var result = confirm("你真的要删除吗?");
438
- if (result) {
439
- return [a, b, c];
440
- } else {
441
- return [a, "CANCELED", c];
442
  }
 
443
  }''')
444
  historyFileSelectDropdown.change(**load_history_from_file_args)
445
  downloadFile.change(upload_chat_history, [current_model, downloadFile, user_name], [saveFileName, systemPromptTxt, chatbot])
 
434
  )
435
  historyRefreshBtn.click(**refresh_history_args)
436
  historyDeleteBtn.click(delete_chat_history, [current_model, historyFileSelectDropdown, user_name], [status_display, historyFileSelectDropdown], _js='''function showConfirmationDialog(a, b, c) {
437
+ if (b != "") {
438
+ var result = confirm("你真的要删除 " + b + " 吗?");
439
+ if (result) {
440
+ return [a, b, c];
441
+ }
442
  }
443
+ return [a, "CANCELED", c];
444
  }''')
445
  historyFileSelectDropdown.change(**load_history_from_file_args)
446
  downloadFile.change(upload_chat_history, [current_model, downloadFile, user_name], [saveFileName, systemPromptTxt, chatbot])