From 76ec2064adab572de46a2d11ef0a5e38ef181295 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 11 Feb 2024 08:29:23 +0100 Subject: Add disable history button in GUI --- g4f/gui/client/html/index.html | 9 +++++++-- g4f/gui/client/js/chat.v1.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'g4f') diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html index d91e9b77..70b8c75f 100644 --- a/g4f/gui/client/html/index.html +++ b/g4f/gui/client/html/index.html @@ -168,14 +168,19 @@
- + Web Access
- + Image Generator
+
+ + + Disable History +
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js index a925572a..a243b1de 100644 --- a/g4f/gui/client/js/chat.v1.js +++ b/g4f/gui/client/js/chat.v1.js @@ -100,6 +100,11 @@ const ask_gpt = async () => { delete messages[i]["provider"]; } + // Remove history, if it is selected + if (document.getElementById('history')?.checked) { + messages = [messages[messages.length-1]] + } + window.scrollTo(0, 0); window.controller = new AbortController(); @@ -491,7 +496,7 @@ document.querySelector(".mobile-sidebar").addEventListener("click", (event) => { }); const register_settings_localstorage = async () => { - for (id of ["switch", "model", "jailbreak", "patch", "provider"]) { + for (id of ["switch", "model", "jailbreak", "patch", "provider", "history"]) { element = document.getElementById(id); element.addEventListener('change', async (event) => { switch (event.target.type) { @@ -509,7 +514,7 @@ const register_settings_localstorage = async () => { } const load_settings_localstorage = async () => { - for (id of ["switch", "model", "jailbreak", "patch", "provider"]) { + for (id of ["switch", "model", "jailbreak", "patch", "provider", "history"]) { element = document.getElementById(id); value = localStorage.getItem(element.id); if (value) { -- cgit v1.2.3