Skip to content

Commit

Permalink
fix: don't copy chat hist for tracking (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored Dec 5, 2024
1 parent 148360f commit f1c2c87
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f1c2c87

Please sign in to comment.