Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't copy chat hist for tracking #617

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading