Facebook
twitter
LinkedIn
Instagram
function setWaiting(waiting) { isWaiting = waiting; if (waiting) { typingIndicator.classList.remove('d-none'); typingIndicator.style.setProperty('display', 'flex', 'important'); sendBtn.disabled = true; } else { typingIndicator.classList.add('d-none'); typingIndicator.style.setProperty('display', 'none', 'important'); sendBtn.disabled = false; } scrollToBottom(); } function scrollToBottom() { setTimeout(function () { messagesBox.scrollTop = messagesBox.scrollHeight; }, 50); } function escapeHtml(str) { if (!str) return ''; return str.replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function formatMarkdown(text) { if (!text) return ''; var escaped = escapeHtml(text); escaped = escaped.replace(/\*\*(.*?)\*\*/g, '$1'); escaped = escaped.replace(/^\s*[•\-\*]\s+(.*)$/gm, '
  • $1
  • '); escaped = escaped.replace(/(
  • .*<\/li>)/s, ''); escaped = escaped.replace(/\n\n/g, '

    '); escaped = escaped.replace(/\n/g, '
    '); return escaped; } })();