                const typingElement = document.getElementById("typing");
                if (typingElement) {
                    messages.removeChild(typingElement);
                }
            };

            const sendMessage = async () => {
                const userMessage = userMessageInput.value.trim();
                if (!userMessage) return;

                addMessage(userMessage, "user");
                userMessageInput.value = "";

                showTypingAnimation();

                try 