fix: Show chat HTML only after WebSocket ready - Prevents handleMentionInput undefined error - Chat content hidden until WebSocket opens - Fixes SD issues between JS and HTML loading
All checks were successful
BotServer CI / build (push) Successful in 8m57s
All checks were successful
BotServer CI / build (push) Successful in 8m57s
This commit is contained in:
parent
8c046118a9
commit
86d4bb4f26
3 changed files with 25 additions and 14 deletions
|
|
@ -122,5 +122,15 @@ function initChat() {
|
||||||
proceedWithChatInit();
|
proceedWithChatInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showChatApp() {
|
||||||
|
var chatApp = document.getElementById("chat-app");
|
||||||
|
if (chatApp) {
|
||||||
|
chatApp.style.opacity = "1";
|
||||||
|
chatApp.style.visibility = "visible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.showChatApp = showChatApp;
|
||||||
|
|
||||||
setupEventHandlers();
|
setupEventHandlers();
|
||||||
initChat();
|
initChat();
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,10 @@ function connectWebSocket() {
|
||||||
ChatState.disconnectNotified = false;
|
ChatState.disconnectNotified = false;
|
||||||
updateConnectionStatus("connected");
|
updateConnectionStatus("connected");
|
||||||
var loadingOverlay = document.getElementById("chatLoadingOverlay");
|
var loadingOverlay = document.getElementById("chatLoadingOverlay");
|
||||||
var contentWrapper = document.getElementById("chatContentWrapper");
|
|
||||||
if (loadingOverlay) loadingOverlay.style.display = "none";
|
if (loadingOverlay) loadingOverlay.style.display = "none";
|
||||||
if (contentWrapper) contentWrapper.style.display = "flex";
|
if (typeof window.showChatApp === "function") {
|
||||||
|
window.showChatApp();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatState.ws.onmessage = function (event) {
|
ChatState.ws.onmessage = function (event) {
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
<link rel="stylesheet" href="/suite/css/markdown-message.css" />
|
<link rel="stylesheet" href="/suite/css/markdown-message.css" />
|
||||||
<link rel="stylesheet" href="/suite/css/chat-agent-mode.css" />
|
<link rel="stylesheet" href="/suite/css/chat-agent-mode.css" />
|
||||||
|
|
||||||
<div class="chat-layout" id="chat-app">
|
<div class="chat-layout" id="chat-app" style="opacity: 0; visibility: hidden;">
|
||||||
<div class="chat-loading-overlay" id="chatLoadingOverlay">
|
<div class="chat-loading-overlay" id="chatLoadingOverlay">
|
||||||
<div class="chat-loading-spinner"></div>
|
<div class="chat-loading-spinner"></div>
|
||||||
<div class="chat-loading-text">Carregando...</div>
|
<div class="chat-loading-text">Carregando...</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chat-content-wrapper" id="chatContentWrapper" style="display: none;">
|
<div class="chat-content-wrapper" id="chatContentWrapper">
|
||||||
<div class="connection-status connecting" id="connectionStatus" style="display: none">
|
<div class="connection-status connecting" id="connectionStatus" style="display: none">
|
||||||
<span class="connection-status-dot"></span>
|
<span class="connection-status-dot"></span>
|
||||||
<span class="connection-text">Connecting...</span>
|
<span class="connection-text">Connecting...</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue