Added sorting of messages

This commit is contained in:
Peter Morton 2025-06-06 16:10:57 -05:00
parent 0b10862320
commit a00fb4f133

View File

@ -7,6 +7,8 @@
let notes = ["No History Found"];
let startTime = new Date();
if (history.messages.length > 0) {
history.messages.sort((a, b) => new Date(a.dateSent) - new Date(b.dateSent));
notes = history.messages
.map(
(message) =>
@ -14,12 +16,6 @@
)
.filter((text) => text.trim() !== "");
startTime = new Date(history.messages[0]?.dateSent || startTime);
// reverse notes so that older messages are at the top
notes.reverse();
notes.forEach((note, index) => {
console.log(`Note ${index + 1}: ${note}`);
});
}
const endTime = new Date();
const url = `https://ivastudio.verint.live/organizations/${recognizedObject.classificationResults.organizationId}/workspaces/${conversationData.workspaceId}/conversation/${conversationData.id}`;