Employee Legal Rights Awareness Chatbot

Employee Legal Rights Bot

Online

Hello! I'm the Employee Legal Rights Bot. I can provide general information on common workplace rights in the United States.

Please select a topic to begin:

Disclaimer: I am an AI bot and not a lawyer. This information is for educational purposes only and is not legal advice.
`); const mainTopics = Object.keys(knowledgeBase).map(topic => ({ text: topic, action: 'select_topic', payload: topic })); showOptions(mainTopics); }; // Handles clicks on option buttons const handleOptionClick = (e) => { const target = e.target.closest('.chat-option-btn'); if (!target) return; const { action, payload } = target.dataset; addUserMessage(target.textContent); if (action === 'select_topic') { const topic = knowledgeBase[payload]; addBotMessage(topic.intro); const questionOptions = topic.questions.map((item, index) => ({ text: item.q, action: 'ask_question', payload: `${payload}|${index}` })); questionOptions.push({ text: 'Start Over', action: 'start_over', payload: '' }); showOptions(questionOptions); } else if (action === 'ask_question') { const [topicKey, questionIndex] = payload.split('|'); const topic = knowledgeBase[topicKey]; const answer = topic.questions[questionIndex].a; addBotMessage(answer); } else if (action === 'start_over') { startConversation(); } }; // --- PDF GENERATION --- const generatePDF = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const margin = 15; const pageWidth = doc.internal.pageSize.getWidth(); const usableWidth = pageWidth - (margin * 2); let yPos = margin; doc.setFontSize(18).setFont('helvetica', 'bold'); doc.text('Chat Transcript: Employee Legal Rights Bot', pageWidth / 2, yPos, { align: 'center' }); yPos += 10; doc.setFontSize(8).setFont('helvetica', 'italic'); doc.text(`Generated on: ${new Date().toLocaleString('en-US')}`, pageWidth / 2, yPos, { align: 'center' }); yPos += 15; doc.setFontSize(9).setFont('helvetica', 'normal'); const disclaimerText = "Disclaimer: This is an automated transcript for informational purposes only. The content provided by the chatbot does not constitute legal advice. Always consult with a qualified legal professional for advice on your specific situation."; const splitDisclaimer = doc.splitTextToSize(disclaimerText, usableWidth); doc.text(splitDisclaimer, margin, yPos); yPos += (splitDisclaimer.length * 4) + 10; const messages = messageList.querySelectorAll('.chat-bubble'); messages.forEach(msg => { const isBot = msg.classList.contains('bot-bubble'); const text = msg.innerText; if (yPos > doc.internal.pageSize.getHeight() - 20) { doc.addPage(); yPos = margin; } doc.setFontSize(11); doc.setFont('helvetica', isBot ? 'normal' : 'bold'); doc.text(isBot ? "Bot:" : "You:", margin, yPos); doc.setFont('helvetica', 'normal'); const splitText = doc.splitTextToSize(text, usableWidth - 10); doc.text(splitText, margin + 10, yPos); yPos += (splitText.length * 5) + 5; // Add spacing }); doc.save('Employee_Rights_Chat_Transcript.pdf'); }; // --- EVENT LISTENERS --- optionsContainer.addEventListener('click', handleOptionClick); downloadPdfBtn.addEventListener('click', generatePDF); // --- KICKOFF --- startConversation(); });
Scroll to Top