Skip to content

Commit

Permalink
Bug fix in inline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Sep 27, 2023
1 parent 09ca0ce commit d9e6198
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions backend/files/system/openai/front.files/chat/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,24 @@ function aista_create_chat_ui() {
window.document.body.appendChild(aistaChatWnd);
}

// Adding event listener to input field to allow for closing it with escape key.
const aistaChatInpField = document.getElementsByClassName('aista-chat-prompt')[0];
aistaChatInpField.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
aistaChatWnd.style.display = 'none';
const btns = window.document.getElementsByClassName('aista-chat-btn');
if (btns.length > 0) {
btns[0].style.display = 'block';
}
if (ainiro_con) {
ainiro_con.stop();
ainiro_con = null;
if (!ainiroParentElement || ainiroParentElement === '') {

// Adding event listener to input field to allow for closing it with escape key.
const aistaChatInpField = document.getElementsByClassName('aista-chat-prompt')[0];
aistaChatInpField.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
aistaChatWnd.style.display = 'none';
const btns = window.document.getElementsByClassName('aista-chat-btn');
if (btns.length > 0) {
btns[0].style.display = 'block';
}
if (ainiro_con) {
ainiro_con.stop();
ainiro_con = null;
}
}
}
});
});
}

// Add an event listener to the close button.
window.document.getElementsByClassName('aista-chat-close-btn')[0].addEventListener('click', () => {
Expand Down

0 comments on commit d9e6198

Please sign in to comment.