From 4d2e5332d804fa87b88865ad954ee7a964c3a9de Mon Sep 17 00:00:00 2001 From: Christian Rute Date: Thu, 31 Oct 2024 16:08:07 +0100 Subject: [PATCH] fix --- client/js/chat.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/js/chat.js b/client/js/chat.js index 9d38052..a0c4eff 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -43,7 +43,7 @@ async function saveMessage(chatId, message) { localStorage.setItem(`chatHistory-${chatId}`, JSON.stringify(chatHistory)); // Aktualisiere den Button-Text in der Sidebar - updateChatSessionButton(chatId, message); + updateChatSessionButton(chatId); // Sende die Nachricht an den Chatbot const userMessage = getLastUserMessage(); @@ -56,7 +56,7 @@ async function saveMessage(chatId, message) { } } -function updateChatSessionButton(chatId, message) { +function updateChatSessionButton(chatId) { const button = document.getElementById(`chatSession-${chatId}`); if (button) { const chatHistory = JSON.parse(localStorage.getItem(`chatHistory-${chatId}`)) || []; @@ -138,6 +138,10 @@ function loadAllChatSessions() { } }); console.log(chatCount) + + for (let i = 0; i < chatCount; i++) {// Aktualisiere die Namen an der Seite + updateChatSessionButton(i); + } // Lade den neuesten Chat-Verlauf if (chatCount > 0) { loadChatHistory(chatCount - 1); @@ -294,6 +298,3 @@ async function stream_api_open_ai(userMessage) { } return result; } - - -//TODO: Die Chatbot-Nachrichten müssen noch in den Cache geladen werden!!! \ No newline at end of file