{% for faq in faqs %}
{% endfor %}
@@ -159,7 +160,8 @@
let history = [];
// ── Greeting on page load ──────────────────────────────────────────────
- appendMessage('ai', "👋 Hi {{ current_user.display_name }}! I'm your JQC support assistant. " +
+ var userName = {{ current_user.display_name | tojson }};
+ appendMessage('ai', "👋 Hi " + userName + "! I'm your JQC support assistant. " +
"I can help you with inspections, issues, reports, and more. " +
"Click a question below or type your own.");
@@ -249,9 +251,9 @@
sendMessage(chatInput.value);
};
- window.sendFaq = function (btn, text) {
+ window.sendFaq = function (btn) {
btn.disabled = true;
- sendMessage(text);
+ sendMessage(btn.dataset.faq);
};
// ── Enter key support ──────────────────────────────────────────────────