Skip to content

Commit

Permalink
feat: add function to get all chat messages currently on the website
Browse files Browse the repository at this point in the history
  • Loading branch information
JonBergland committed Nov 7, 2024
1 parent 687d93a commit 6be9ee4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ let html = /*html*/`
<div id=${uuid} class="chat_message"> ${message} </div>
</li>`;
document.getElementById('chat_history').innerHTML += html;
const messages = getAllChatMessages();
console.log(messages);
}

async function getAllChatMessages() {
const chatMessages = document.querySelectorAll('.chat_message');
const messagesList = [];
chatMessages.forEach((element) => {
messagesList.push(element.textContent.trim());
});
return messagesList;
}

async function addStreamedMessage(uuid, messagePart) {
Expand Down

0 comments on commit 6be9ee4

Please sign in to comment.