From 14b14e26ec63baab6b7105d52e3d33dee0f69221 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 7 Jan 2023 20:30:17 -0500 Subject: [PATCH] Fix for Javascript error on playing last action's TTS audio --- static/koboldai.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index 042e3e61..4c58293b 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -3293,7 +3293,9 @@ function finished_tts() { } else { action = document.getElementById("Selected Text Chunk "+(next_action-1)); } - action.classList.remove("tts_playing"); + if (action) { + action.classList.remove("tts_playing"); + } if (next_action <= action_count) { document.getElementById("reader").src = "/audio?id="+next_action; document.getElementById("reader").setAttribute("action_id", next_action); @@ -3311,7 +3313,9 @@ function tts_playing() { } else { action = document.getElementById("Selected Text Chunk "+action_id); } - action.classList.add("tts_playing"); + if (action) { + action.classList.add("tts_playing"); + } } function view_selection_probabilities() {