@cryptotaxi247 / netdata-1 / commits / d07161a0b

Ensure chat exists before handling message input (#20700)

Emmanuel Ferdman committed Jul 19, 2025 at 22:09 UTC d07161a0b2707716dcf79c7f9ae0d108f1a6747e
1 file changed +4 -4
src/web/mcp/mcp-web-client/web/app.js
+4 -4
@@ -7014,6 +7014,9 @@ class NetdataMCPChat {
7014
7015 // Messaging
7016 async sendMessage(chatId, messageParam = null, isResume = false) {
7017 + const chat = this.chats.get(chatId);
7018 + if (!chat) {return;}
7019 +
7020 // If no message provided, get it from the input
7021 let message = messageParam;
7022 if (message === null) {
@@ -7039,10 +7042,7 @@ class NetdataMCPChat {
7042 return;
7043 }
7044 }
7042 -
7043 - const chat = this.chats.get(chatId);
7044 - if (!chat) {return;}
7045 -
7045 +
7046 // Clear error state when sending new message
7047 chat.hasError = false;
7048 chat.lastError = null;