From f1c2c87d062c739411a045656f70f9c6e85d66da Mon Sep 17 00:00:00 2001 From: ellvix Date: Thu, 5 Dec 2024 08:43:34 -0700 Subject: [PATCH] fix: don't copy chat hist for tracking (#617) --- src/js/constants.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 8ed9a058..388d0080 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -2010,7 +2010,7 @@ class ChatLLM { * * @param {Event|undefined} e - The event that triggered the copy action. If undefined, the entire chat history is copied. */ - CopyChatHistory(e) { + CopyChatHistory(e, actuallyCopy = true) { let text = ''; let notificationText = ''; if (typeof e == 'undefined') { @@ -2072,10 +2072,12 @@ class ChatLLM { } } - try { - navigator.clipboard.writeText(markdown); // note: this fails if you're on the inspector. That's fine as it'll never happen to real users - } catch (err) { - console.error('Failed to copy: ', err); + if (actuallyCopy) { + try { + navigator.clipboard.writeText(markdown); // note: this fails if you're on the inspector. That's fine as it'll never happen to real users + } catch (err) { + console.error('Failed to copy: ', err); + } } return markdown; } @@ -2343,7 +2345,7 @@ class ChatLLM { // if we're tracking, log the data if (constants.canTrack) { - let chatHist = chatLLM.CopyChatHistory(); + let chatHist = chatLLM.CopyChatHistory(undefined, false); let data = {}; data.chatHistory = chatHist; if (constants.emailAuthKey) data.username = constants.emailAuthKey;