Add or update suggested questions shown in the chatbot UI — initial chips and help panel groups. Edits i18n files (en/vi/ja) and Vue components together.
Thêm hoặc sửa câu hỏi gợi ý hiển thị trong giao diện chat. Code và comment viết bằng tiếng Anh. Giải thích cho người dùng bằng tiếng Việt.
/update-chat-suggestions <mô tả thay đổi>
Ví dụ:
/update-chat-suggestions thêm câu hỏi về export báo cáo vào help panel (admin)
/update-chat-suggestions đổi câu hỏi chip "How to create a leave request?" thành "How to submit a leave request?"
/update-chat-suggestions thêm nhóm "Reports" vào help panel cho admin với 2 câu hỏi
Câu hỏi gợi ý có 2 vùng độc lập:
Hiển thị khi chat còn trống. 4 câu cho tất cả + 1 câu chỉ admin.
chatbot.suggestions.<key>sources/attendance_client/components/chatbot/ChatbotWidget.vue
SUGGESTED_QUESTIONS computed (line ~255): thêm/xóa t('chatbot.suggestions.<key>')adminQuestions array; Employee: thêm vào employeeQuestions arrayPanel bên cạnh chat, câu hỏi theo nhóm chủ đề.
chatbot.help.groups.<groupKey>chatbot.help.questions.<questionKey>sources/attendance_client/components/chatbot/ChatbotHelpPanel.vue
helpGroups computed (line ~43): thêm nhóm mới hoặc câu hỏi vào nhóm hiện cóif (userStore.isAdmin) với adminOnly: truesources/attendance_client/i18n/locales/en.json ← English (viết trước)
sources/attendance_client/i18n/locales/vi.json ← Tiếng Việt
sources/attendance_client/i18n/locales/ja.json ← 日本語
Tất cả chatbot keys nằm ở cuối file, trong section "chatbot": { ... }.
| groupKey | adminOnly | Các questionKey hiện có |
|---|---|---|
requests | ❌ | createLeave, createWfh, createOvertime, borrowEquipment, forgetClock |
clockInOut | ❌ | clockQr, clockBiometric, clockWfh |
myRequests | ❌ | editRequest, reuseRequest, trackStatus |
approvals | ✅ | whereApprove, rejectRequest, pendingBadge |
attendance | ✅ | syncDevice, viewLogs, generateQr |
usersOrg | ✅ | manageUsers, assignDept, setDeviceId |
integrations | ✅ | configSlack, configGoogleSheets |
Đọc file liên quan để hiểu nội dung hiện tại:
ChatbotWidget.vue đoạn SUGGESTED_QUESTIONSChatbotHelpPanel.vue đoạn helpGroupsen.json để biết format và keys hiện cóThêm câu hỏi mới vào nhóm hiện có:
"questions": {
...existing keys...,
"newQuestionKey": "Question text in English?"
}
Thêm nhóm mới:
"groups": {
...existing keys...,
"newGroupKey": "Group Label"
},
"questions": {
...existing keys...,
"newQ1": "Question 1?",
"newQ2": "Question 2?"
}
Sau khi sửa en.json → sửa vi.json và ja.json với cùng key, dịch phù hợp.
Quy tắc i18n:
@ trong chuỗi tiếng Việt → escape thành {'@'}Thêm câu hỏi vào chips (ChatbotWidget.vue):
const employeeQuestions = [
t('chatbot.suggestions.existingKey'),
t('chatbot.suggestions.newKey'), // thêm vào đây
]
// hoặc admin-only:
const adminQuestions = [
t('chatbot.suggestions.adminApproval'),
t('chatbot.suggestions.newAdminKey'), // thêm vào đây
]
Thêm câu hỏi vào nhóm hiện có (ChatbotHelpPanel.vue):
{
label: t('chatbot.help.groups.requests'),
questions: [
t('chatbot.help.questions.createLeave'),
t('chatbot.help.questions.newQuestionKey'), // thêm vào đây
],
},
Thêm nhóm mới (admin-only) vào ChatbotHelpPanel.vue:
if (userStore.isAdmin) {
groups.push(
...existing admin groups...,
{
label: t('chatbot.help.groups.newGroupKey'),
questions: [
t('chatbot.help.questions.newQ1'),
t('chatbot.help.questions.newQ2'),
],
adminOnly: true,
},
)
}
make client-lint-fix
Kiểm tra nhanh:
node -e "const fs=require('fs'); const json=JSON.parse(fs.readFileSync('sources/attendance_client/i18n/locales/en.json')); console.log(json.chatbot.help.questions)"
Trình bày bằng tiếng Việt:
/update-prompts