Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu commited on
Commit ·
d386f8b
1
Parent(s): 10cfc85
feat: 删除历史之后清空聊天框
Browse files- ChuanhuChatbot.py +1 -1
- modules/models/base_model.py +2 -2
ChuanhuChatbot.py
CHANGED
|
@@ -433,7 +433,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 433 |
show_progress=True,
|
| 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) {
|
|
|
|
| 433 |
show_progress=True,
|
| 434 |
)
|
| 435 |
historyRefreshBtn.click(**refresh_history_args)
|
| 436 |
+
historyDeleteBtn.click(delete_chat_history, [current_model, historyFileSelectDropdown, user_name], [status_display, historyFileSelectDropdown, chatbot], _js='''function showConfirmationDialog(a, b, c) {
|
| 437 |
if (b != "") {
|
| 438 |
var result = confirm("你真的要删除 " + b + " 吗?");
|
| 439 |
if (result) {
|
modules/models/base_model.py
CHANGED
|
@@ -678,10 +678,10 @@ class BaseLLMModel:
|
|
| 678 |
history_file_path = filename
|
| 679 |
try:
|
| 680 |
os.remove(history_file_path)
|
| 681 |
-
return i18n("删除对话历史成功"), get_history_names(False, user_name)
|
| 682 |
except:
|
| 683 |
logging.info(f"删除对话历史失败 {history_file_path}")
|
| 684 |
-
return i18n("对话历史")+filename+i18n("已经被删除啦"), gr.update()
|
| 685 |
|
| 686 |
def auto_load(self):
|
| 687 |
if self.user_identifier == "":
|
|
|
|
| 678 |
history_file_path = filename
|
| 679 |
try:
|
| 680 |
os.remove(history_file_path)
|
| 681 |
+
return i18n("删除对话历史成功"), get_history_names(False, user_name), []
|
| 682 |
except:
|
| 683 |
logging.info(f"删除对话历史失败 {history_file_path}")
|
| 684 |
+
return i18n("对话历史")+filename+i18n("已经被删除啦"), gr.update(), gr.update()
|
| 685 |
|
| 686 |
def auto_load(self):
|
| 687 |
if self.user_identifier == "":
|