Skip to content

Commit

Permalink
chore: build and documentation for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 7, 2024
1 parent 01f42d0 commit 243ba5f
Show file tree
Hide file tree
Showing 47 changed files with 403 additions and 145 deletions.
88 changes: 82 additions & 6 deletions dist/maidr.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class Resources {
openai: 'OpenAI Vision',
gemini: 'Gemini Pro Vision',
multi: 'Multiple AI',
processing: 'Processing Chart...',
},
},
};
Expand Down Expand Up @@ -443,7 +444,7 @@ class Menu {
</div>
</div>
<div class="modal-footer">
<button type="button" id="save_and_close_menu">Save and Close</button>
<button type="button" id="save_and_close_menu" aria-labelledby="save_and_close_text"><span id="save_and_close_text">Save and Close</span></button>
<button type="button" id="close_menu">Close</button>
</div>
</div>
Expand Down Expand Up @@ -579,6 +580,16 @@ class Menu {
}
},
]);

// trigger notification that LLM will be reset
// this is done on change of LLM model, multi settings, or skill level
constants.events.push([
document.getElementById('LLM_model'),
'change',
function (e) {
menu.NotifyOfLLMReset();
},
]);
}

/**
Expand Down Expand Up @@ -720,6 +731,9 @@ class Menu {
document.getElementById('LLM_preferences').value =
constants.LLMPreferences;
}
if (document.getElementById('LLM_reset_notification')) {
document.getElementById('LLM_reset_notification').remove();
}
}

/**
Expand Down Expand Up @@ -777,6 +791,24 @@ class Menu {
.setAttribute('aria-live', constants.ariaMode);
}

/**
* Notifies the user that the LLM will be reset.
*/
NotifyOfLLMReset() {
let html =
'<p id="LLM_reset_notification">Note: Changes in LLM settings will reset any existing conversation.</p>';
document
.getElementById('save_and_close_menu')
.insertAdjacentHTML('beforebegin', html);

// add to aria button text
document
.getElementById('save_and_close_menu')
.setAttribute(
'aria-labelledby',
'save_and_close_text LLM_reset_notification'
);
}
/**
* Handles changes to the LLM model and multi-modal settings.
* We reset if we change the LLM model, multi settings, or skill level.
Expand Down Expand Up @@ -895,8 +927,11 @@ class ChatLLM {
</button>
</div>
<div class="modal-body">
<div id="chatLLM_chat_history_wrapper">
<div id="chatLLM_chat_history" aria-live="${constants.ariaMode}" aria-relevant="additions">
</div>
<p id="chatLLM_copy_all_wrapper"><button id="chatLLM_copy_all">Copy all to clipboard</button></p>
</div>
<div id="chatLLM_content">
<p><input type="text" id="chatLLM_input" class="form-control" name="chatLLM_input" aria-labelledby="chatLLM_title" size="50"></p>
<div class="LLM_suggestions">
Expand Down Expand Up @@ -1038,10 +1073,41 @@ class ChatLLM {
document.getElementById('reset_chatLLM'),
'click',
function (e) {
chatLLM.Toggle(false);
chatLLM.ResetChatHistory();
},
]);

// copy to clipboard
constants.events.push([
document.getElementById('chatLLM_copy_all'),
'click',
function (e) {
let text = document.getElementById('chatLLM_chat_history').innerText;
// need newlines instead of paragraphs headings etc
text = text.replace(/<p>/g, '\n').replace(/<\/p>/g, '\n');
text = text.replace(/<h\d>/g, '\n').replace(/<\/h\d>/g, '\n');
text = text.replace(/<.*?>/g, '');

navigator.clipboard.writeText(text);
},
]);
constants.events.push([
document.getElementById('chatLLM_chat_history'),
'click',
function (e) {
// we're delegating here, so set the event on child .chatLLM_message_copy_button
if (e.target.matches('.chatLLM_message_copy_button')) {
// get the innerText of the element before the button
let text = e.target.closest('p').previousElementSibling.innerText;
// need newlines instead of paragraphs headings etc
text = text.replace(/<p>/g, '\n').replace(/<\/p>/g, '\n');
text = text.replace(/<h\d>/g, '\n').replace(/<\/h\d>/g, '\n');
text = text.replace(/<.*?>/g, '');

navigator.clipboard.writeText(text);
}
},
]);
}

/**
Expand Down Expand Up @@ -1122,7 +1188,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 @@ -1326,9 +1392,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 Expand Up @@ -1368,6 +1434,12 @@ class ChatLLM {
<p class="chatLLM_message_text">${text}</p>
</div>
`;
// add a copy button to actual messages
if (user != 'User' && text != resources.GetString('processing')) {
html += `
<p class="chatLLM_message_copy"><button class="chatLLM_message_copy_button">Copy</button></p>
`;
}

this.RenderChatMessage(html);
}
Expand Down Expand Up @@ -1445,7 +1517,11 @@ class ChatLLM {
// get name from resource
let LLMName = resources.GetString(constants.LLMModel);
this.firstTime = false;
this.DisplayChatMessage(LLMName, 'Processing Chart...', true);
this.DisplayChatMessage(
LLMName,
resources.GetString('processing'),
true
);
let defaultPrompt = this.GetDefaultPrompt();
this.Submit(defaultPrompt, true);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/maidr.min.js

Large diffs are not rendered by default.

31 changes: 27 additions & 4 deletions dist/maidr_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,24 @@ textarea {

/* LLM stuff */

#chatLLM_chat_history {
#chatLLM_chat_history_wrapper {
position: relative;
height: 100%;
min-height: 400px;
max-height: 450px;
overflow-y: auto;
padding: 0.5rem;
background-color: #fff;
border: 1px solid #dee2e6;
}

#chatLLM_chat_history {
overflow-y: auto;
height: 100%;
min-height: 400px;
max-height: 450px;
padding: 0.5rem;
padding-bottom: 4rem;
border-radius: 0.25rem;
border: 1px solid #dee2e6;
display: flex;
flex-direction: column;
align-items: column;
Expand All @@ -319,12 +328,26 @@ textarea {
align-self: flex-start;
}

.LLM_suggestions > p > button {
.LLM_suggestions > p > button,
#chatLLM_copy_all {
font-weight: normal;
border-radius: 0.5rem;
border: none;
}

.LLM_suggestions > p {
display: inline-block;
}

/* align this to the lower right of the chat history */

#chatLLM_copy_all_wrapper {
position: absolute;
bottom: -0.5rem;
right: 1.5rem;
margin: 0.5rem;
}

.chatLLM_message_copy_button {
font-weight: normal;
}
2 changes: 1 addition & 1 deletion dist/maidr_style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/Audio.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/BarChart.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/BoxPlot.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/BoxplotRect.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/ChatLLM.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Constants.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Constants_ConvertHexToRGBString.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Constants_ConvertRGBStringToHex.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Constants_GetStyleArrayFromString.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Constants_GetStyleStringFromArray.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Control.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/Description.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Display.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/HeatMap.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/HeatMapRect.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/Helper.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Histogram.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Layer0Point.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Layer1Point.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/LinePlot.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/LogError.html

Large diffs are not rendered by default.

101 changes: 92 additions & 9 deletions docs/Menu.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Point.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/Position.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/Resources.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/Review.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/ScatterPlot.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/Segmented.html

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/Tracker.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/audio.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/barplot.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/boxplot.js.html

Large diffs are not rendered by default.

92 changes: 84 additions & 8 deletions docs/constants.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/controls.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/display.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/global.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/heatmap.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/histogram.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/init.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/lineplot.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/scatterplot.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/segmented.js.html

Large diffs are not rendered by default.

0 comments on commit 243ba5f

Please sign in to comment.