From 80b2e9b80774c558cb863841e7e8214fbc0eca67 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 20 May 2024 01:28:08 +0200 Subject: Add some options to messages in gui, saves generated images local --- g4f/gui/client/static/js/chat.v1.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'g4f/gui/client/static/js') diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 47bfdd3b..9790b261 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -192,6 +192,26 @@ const register_message_buttons = async () => { }) } }); + document.querySelectorAll(".message .fa-whatsapp").forEach(async (el) => { + if (!el.parentElement.href) { + const text = el.parentElement.parentElement.parentElement.innerText; + el.parentElement.href = `https://wa.me/?text=${encodeURIComponent(text)}`; + } + }); + document.querySelectorAll(".message .fa-print").forEach(async (el) => { + if (!("click" in el.dataset)) { + el.dataset.click = "true"; + el.addEventListener("click", async () => { + const message_el = el.parentElement.parentElement.parentElement; + el.classList.add("clicked"); + message_box.scrollTop = 0; + message_el.classList.add("print"); + setTimeout(() => el.classList.remove("clicked"), 1000); + setTimeout(() => message_el.classList.remove("print"), 1000); + window.print() + }) + } + }); } const delete_conversations = async () => { @@ -253,6 +273,8 @@ const handle_ask = async () => { ${count_words_and_tokens(message, get_selected_model())} + + @@ -625,6 +647,8 @@ const load_conversation = async (conversation_id, scroll=true) => { ${count_words_and_tokens(item.content, next_provider?.model)} + + -- cgit v1.2.3