From 9316df5ab37b57c9295931b3d7fe87a17b843f31 Mon Sep 17 00:00:00 2001 From: ellvix Date: Sun, 1 Dec 2024 17:39:49 -0700 Subject: [PATCH] Fix update tracker to correctly save chat history (#608) --- src/js/audio.js | 5 +++++ src/js/constants.js | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/audio.js b/src/js/audio.js index f1c3805f5..5812067b8 100644 --- a/src/js/audio.js +++ b/src/js/audio.js @@ -38,6 +38,11 @@ class Audio { * Triggers playOscillator() with the correct parameters. */ playTone(params = null) { + // workaround for FF starting audio context in a suspended state + if (this.audioContext.state === 'suspended') { + this.audioContext.resume(); + } + let currentDuration = constants.duration; let volume = constants.vol; if (params != null) { diff --git a/src/js/constants.js b/src/js/constants.js index 518aec05c..cb6867fe4 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -2271,8 +2271,7 @@ class ChatLLM { if (data.text()) { text = data.text(); chatLLM.DisplayChatMessage(LLMName, text); - } - if (data.error) { + } else if (data.error) { chatLLM.DisplayChatMessage(LLMName, 'Error processing request.', true); chatLLM.WaitingSound(false); } @@ -2281,7 +2280,7 @@ class ChatLLM { // if we're tracking, log the data if (constants.canTrack) { let chatHist = chatLLM.CopyChatHistory(); - tracker.SetData('ChatHistory', chatHist); + tracker.SetData('ChatHistory', { chatHistory: chatHist }); } }