Skip to content

Commit

Permalink
fix: barplot autoplay left (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored Oct 16, 2024
1 parent 5c67114 commit 749da16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions examples/rawplot.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
href="https://cdn.jsdelivr.net/npm/maidr/dist/maidr_style.min.css"
/>
</head>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/maidr/dist/maidr.min.js"
></script>
<body>
<div>
<svg
Expand Down Expand Up @@ -833,6 +837,7 @@
id: 'eeed0e3c-2c02-4cfa-826b-9af5aa8f9ec5',
};
</script>
<!--
<script src="../src/js/constants.js"></script>
<script src="../src/js/audio.js"></script>
<script src="../src/js/display.js"></script>
Expand All @@ -842,4 +847,5 @@
<script src="../src/js/scatterplot.js"></script>
<script src="../src/js/controls.js"></script>
<script src="../src/js/init.js"></script>
-->
</html>
8 changes: 4 additions & 4 deletions src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 749da16

Please sign in to comment.