From eba48a0f1abbcdac479473b8b1574277a969e204 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Tue, 6 May 2025 22:10:21 +0800 Subject: [PATCH] improve reset conversation ui --- main.py | 2 +- requirements.txt | 2 +- themes/common.js | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 062cba5f..af20207d 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ def encode_plugin_info(k, plugin)->str: def main(): import gradio as gr - if gr.__version__ not in ['3.32.12', '3.32.13']: + if gr.__version__ not in ['3.32.14', '3.32.13']: raise ModuleNotFoundError("使用项目内置Gradio获取最优体验! 请运行 `pip install -r requirements.txt` 指令安装内置Gradio及其他依赖, 详情信息见requirements.txt.") # 一些基础工具 diff --git a/requirements.txt b/requirements.txt index 92c86c01..266c81c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -https://public.agent-matrix.com/publish/gradio-3.32.13-py3-none-any.whl +https://public.agent-matrix.com/publish/gradio-3.32.14-py3-none-any.whl fastapi==0.110 gradio-client==0.8 pypdf2==2.12.1 diff --git a/themes/common.js b/themes/common.js index f05b9b71..87420797 100644 --- a/themes/common.js +++ b/themes/common.js @@ -1184,6 +1184,15 @@ async function clear_conversation(a, b, c) { update_conversation_metadata(); let stopButton = document.getElementById("elem_stop"); stopButton.click(); + // Save back to local storage + try { + const EVENT_NAME = "gptac_reset_btn_clicked"; + window.dispatchEvent( + new CustomEvent(EVENT_NAME, { + detail: "" + }) + ); + } catch (e) {} return reset_conversation(a, b); }