From 749da1674b233a3d99b24b31218e2c221b721000 Mon Sep 17 00:00:00 2001 From: ellvix Date: Tue, 15 Oct 2024 21:35:24 -0600 Subject: [PATCH] fix: barplot autoplay left (#582) --- examples/rawplot.html | 6 ++++++ src/js/constants.js | 8 ++++---- src/js/controls.js | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/rawplot.html b/examples/rawplot.html index 76cf7d4ef..1d0308264 100644 --- a/examples/rawplot.html +++ b/examples/rawplot.html @@ -7,6 +7,10 @@ href="https://cdn.jsdelivr.net/npm/maidr/dist/maidr_style.min.css" /> +
+ diff --git a/src/js/constants.js b/src/js/constants.js index b4fdb5c29..eed67f994 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -1984,7 +1984,7 @@ class ChatLLM { */ ProcessLLMResponse(data, model) { chatLLM.WaitingSound(false); - console.log('LLM response: ', data); + //console.log('LLM response: ', data); let text = ''; let LLMName = resources.GetString(model); @@ -2098,7 +2098,7 @@ class ChatLLM { let url = 'https://api.openai.com/v1/chat/completions'; let auth = constants.openAIAuthKey; let requestJson = chatLLM.OpenAIJson(text, img); - console.log('LLM request: ', requestJson); + //console.log('LLM request: ', requestJson); fetch(url, { method: 'POST', @@ -2202,9 +2202,9 @@ class ChatLLM { }; // Generate the content - console.log('LLM request: ', prompt, image); + //console.log('LLM request: ', prompt, image); const result = await model.generateContent([prompt, image]); - console.log(result.response.text()); + //console.log(result.response.text()); // Process the response chatLLM.ProcessLLMResponse(result.response, 'gemini'); diff --git a/src/js/controls.js b/src/js/controls.js index df4f217e7..3f5064ed1 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -2607,10 +2607,10 @@ class Control { constants.autoplayId = setInterval(function () { position.x += step; - if (position.x < 0 || end - 1 < position.x) { + if (position.x < 0 || plot.plotData.length - 1 < position.x) { constants.KillAutoplay(); control.lockPosition(); - } else if (position.x >= end) { + } else if (position.x == end) { constants.KillAutoplay(); control.UpdateAllAutoPlay(); } else {