From 43b0b26b098ea2db95a27d1b54920901aba9898a Mon Sep 17 00:00:00 2001 From: "G.RQ" <61670021+guoruqiang@users.noreply.github.com> Date: Sat, 28 Dec 2024 07:05:12 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E9=87=8D=E7=BD=AE=E6=8C=89=E9=92=AEb?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 458243a67..aff63ac31 100644 --- a/main.py +++ b/main.py @@ -226,8 +226,8 @@ def fn_area_visibility_2(a): multiplex_sel.select( None, [multiplex_sel], None, _js=f"""(multiplex_sel)=>run_multiplex_shift(multiplex_sel)""") cancel_handles.append(submit_btn.click(**predict_args)) - resetBtn.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>clear_conversation(a,b,c)""") # 先在前端快速清除chatbot&status - resetBtn2.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>clear_conversation(a,b,c)""") # 先在前端快速清除chatbot&status + resetBtn.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>reset_conversation(a,b,c)""") # 先在前端快速清除chatbot&status + resetBtn2.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>reset_conversation(a,b,c)""") # 先在前端快速清除chatbot&status # reset_server_side_args = (lambda history: ([], [], "已重置"), [history], [chatbot, history, status]) # resetBtn.click(*reset_server_side_args) # 再在后端清除history # resetBtn2.click(*reset_server_side_args) # 再在后端清除history From 0e42b8905b5ce00de9a40f22ed50db4e67e3c1cd Mon Sep 17 00:00:00 2001 From: binary-husky Date: Sat, 28 Dec 2024 23:19:02 +0800 Subject: [PATCH 2/2] fix version control bug --- main.py | 4 ++-- themes/common.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index aff63ac31..458243a67 100644 --- a/main.py +++ b/main.py @@ -226,8 +226,8 @@ def fn_area_visibility_2(a): multiplex_sel.select( None, [multiplex_sel], None, _js=f"""(multiplex_sel)=>run_multiplex_shift(multiplex_sel)""") cancel_handles.append(submit_btn.click(**predict_args)) - resetBtn.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>reset_conversation(a,b,c)""") # 先在前端快速清除chatbot&status - resetBtn2.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>reset_conversation(a,b,c)""") # 先在前端快速清除chatbot&status + resetBtn.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>clear_conversation(a,b,c)""") # 先在前端快速清除chatbot&status + resetBtn2.click(None, None, [chatbot, history, status], _js="""(a,b,c)=>clear_conversation(a,b,c)""") # 先在前端快速清除chatbot&status # reset_server_side_args = (lambda history: ([], [], "已重置"), [history], [chatbot, history, status]) # resetBtn.click(*reset_server_side_args) # 再在后端清除history # resetBtn2.click(*reset_server_side_args) # 再在后端清除history diff --git a/themes/common.js b/themes/common.js index d22d5a6e8..04628d1b3 100644 --- a/themes/common.js +++ b/themes/common.js @@ -1070,6 +1070,14 @@ function restore_chat_from_local_storage(event) { } +function clear_conversation(a, b, c) { + update_conversation_metadata(); + let stopButton = document.getElementById("elem_stop"); + stopButton.click(); + // console.log("clear_conversation"); + return reset_conversation(a, b); +} + function reset_conversation(a, b) { // console.log("js_code_reset");