06/09 Fix chatbot common questions doesn't work
This commit is contained in:
@@ -60,7 +60,8 @@
|
||||
<div class="d-flex flex-wrap gap-2 mb-2">
|
||||
{% for faq in faqs %}
|
||||
<button class="btn btn-outline-secondary btn-sm faq-btn"
|
||||
onclick="sendFaq(this, {{ faq.text | tojson }})">
|
||||
data-faq="{{ faq.text | e }}"
|
||||
onclick="sendFaq(this)">
|
||||
<i class="{{ faq.icon }} me-1"></i>{{ faq.text }}
|
||||
</button>
|
||||
{% 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 ──────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user