I want create an Ai chatbot for health and medical. User can ask anything about their health and the Ai chatbot will respond according to their personal health and wellness. Provide recommendations and suggestion for health and wellness. Once the recommendations given, it will create a mechanism to track and guide the user to achieve the recommended interventions.
2641420 verified Download index.html from thipan16/undefined: direct link, hf CLI and curl.
- Browser
- Download file 31.1 kB
-
https://huggingface.co/spaces/thipan16/undefined/resolve/main/index.html
- Command line
-
hf download hf://spaces/thipan16/undefined/index.html
-
curl -L -o index.html https://huggingface.co/spaces/thipan16/undefined/resolve/main/index.html
31.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>MediMate AI - Your Health Companion</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#3B82F6', | |
| secondary: '#10B981', | |
| accent: '#8B5CF6', | |
| dark: '#1E293B', | |
| light: '#F8FAFC' | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| .chat-container { | |
| height: calc(100vh - 200px); | |
| } | |
| .typing-indicator span { | |
| display: inline-block; | |
| width: 8px; | |
| height: 8px; | |
| border-radius: 50%; | |
| background-color: #3B82F6; | |
| margin: 0 2px; | |
| animation: typingAnimation 1.4s infinite ease-in-out; | |
| } | |
| .typing-indicator span:nth-child(2) { | |
| animation-delay: 0.2s; | |
| } | |
| .typing-indicator span:nth-child(3) { | |
| animation-delay: 0.4s; | |
| } | |
| @keyframes typingAnimation { | |
| 0%, 60%, 100% { transform: translateY(0); } | |
| 30% { transform: translateY(-5px); } | |
| } | |
| .progress-ring__circle { | |
| transition: stroke-dashoffset 0.35s; | |
| transform: rotate(-90deg); | |
| transform-origin: 50% 50%; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 text-gray-800 font-sans"> | |
| <div id="vanta-bg" class="fixed inset-0 z-0"></div> | |
| <div class="relative min-h-screen flex flex-col"> | |
| <!-- Header --> | |
| <header class="bg-white bg-opacity-90 shadow-sm z-10"> | |
| <div class="container mx-auto px-4 py-4 flex items-center justify-between"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="bg-primary p-2 rounded-full"> | |
| <i data-feather="heart" class="text-white"></i> | |
| </div> | |
| <h1 class="text-xl font-bold text-dark">MediMate AI</h1> | |
| </div> | |
| <nav> | |
| <ul class="flex space-x-6"> | |
| <li><a href="index.html" class="text-primary font-medium">Home</a></li> | |
| <li><a href="health-records.html" class="text-gray-600 hover:text-primary transition">Health Records</a></li> | |
| <li><a href="wellness-tracker.html" class="text-gray-600 hover:text-primary transition">Wellness Tracker</a></li> | |
| <li><a href="#" class="text-gray-600 hover:text-primary transition">About</a></li> | |
| </ul> | |
| </nav> | |
| <button class="bg-primary text-white px-4 py-2 rounded-full hover:bg-blue-600 transition flex items-center"> | |
| <i data-feather="user" class="mr-2"></i> | |
| Sign In | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="flex-grow container mx-auto px-4 py-8 z-10"> | |
| <div class="max-w-6xl mx-auto bg-white bg-opacity-90 rounded-xl shadow-lg overflow-hidden"> | |
| <div class="grid grid-cols-1 lg:grid-cols-3"> | |
| <!-- Left Panel - User Info --> | |
| <div class="bg-dark text-white p-6 lg:p-8"> | |
| <div class="flex flex-col items-center mb-8"> | |
| <div class="relative mb-4"> | |
| <img src="http://static.photos/medical/200x200/42" alt="User" class="w-24 h-24 rounded-full border-4 border-primary"> | |
| <div class="absolute bottom-0 right-0 bg-secondary rounded-full p-1 border-2 border-white"> | |
| <i data-feather="edit-2" class="w-4 h-4 text-white"></i> | |
| </div> | |
| </div> | |
| <h2 class="text-xl font-bold">Alex Johnson</h2> | |
| <p class="text-gray-300">Age: 32 | Male</p> | |
| </div> | |
| <div class="space-y-6"> | |
| <div> | |
| <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Vital Stats</h3> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div class="bg-gray-800 p-3 rounded-lg"> | |
| <p class="text-sm text-gray-400">Weight</p> | |
| <p class="text-lg font-bold">72 kg</p> | |
| </div> | |
| <div class="bg-gray-800 p-3 rounded-lg"> | |
| <p class="text-sm text-gray-400">Height</p> | |
| <p class="text-lg font-bold">175 cm</p> | |
| </div> | |
| <div class="bg-gray-800 p-3 rounded-lg"> | |
| <p class="text-sm text-gray-400">BP</p> | |
| <p class="text-lg font-bold">120/80</p> | |
| </div> | |
| <div class="bg-gray-800 p-3 rounded-lg"> | |
| <p class="text-sm text-gray-400">Glucose</p> | |
| <p class="text-lg font-bold">96 mg/dL</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Health Goals</h3> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between"> | |
| <span>Weight Loss</span> | |
| <div class="w-16 h-2 bg-gray-700 rounded-full"> | |
| <div class="h-full bg-secondary rounded-full" style="width: 45%"></div> | |
| </div> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span>Cardio Fitness</span> | |
| <div class="w-16 h-2 bg-gray-700 rounded-full"> | |
| <div class="h-full bg-secondary rounded-full" style="width: 65%"></div> | |
| </div> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span>Stress Management</span> | |
| <div class="w-16 h-2 bg-gray-700 rounded-full"> | |
| <div class="h-full bg-secondary rounded-full" style="width: 30%"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-2">Current Recommendations</h3> | |
| <div class="space-y-2"> | |
| <div class="flex items-start space-x-2"> | |
| <div class="mt-1"> | |
| <i data-feather="check-circle" class="text-secondary"></i> | |
| </div> | |
| <p class="text-sm">Daily 30-min walk</p> | |
| </div> | |
| <div class="flex items-start space-x-2"> | |
| <div class="mt-1"> | |
| <i data-feather="check-circle" class="text-secondary"></i> | |
| </div> | |
| <p class="text-sm">Meditation 10 min/day</p> | |
| </div> | |
| <div class="flex items-start space-x-2"> | |
| <div class="mt-1"> | |
| <i data-feather="check-circle" class="text-secondary"></i> | |
| </div> | |
| <p class="text-sm">Increase water intake</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Right Panel - Chat Interface --> | |
| <div class="lg:col-span-2 flex flex-col"> | |
| <div class="p-6 border-b border-gray-200"> | |
| <h2 class="text-xl font-bold text-dark">Health Assistant</h2> | |
| <p class="text-gray-600">Ask me anything about your health and wellness</p> | |
| </div> | |
| <div class="chat-container overflow-y-auto p-6 space-y-4" id="chat-container"> | |
| <!-- Chat messages will be dynamically inserted here --> | |
| </div> | |
| <div class="p-4 border-t border-gray-200"> | |
| <form class="flex items-center space-x-2"> | |
| <div class="flex-grow relative"> | |
| <input type="text" placeholder="Ask about your health..." class="w-full px-4 py-3 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"> | |
| <button type="button" class="absolute right-3 top-3 text-gray-500 hover:text-primary"> | |
| <i data-feather="mic"></i> | |
| </button> | |
| </div> | |
| <button type="submit" class="bg-primary text-white p-3 rounded-full hover:bg-blue-600 transition"> | |
| <i data-feather="send"></i> | |
| </button> | |
| </form> | |
| <div class="mt-2 text-xs text-gray-500 flex items-center"> | |
| <i data-feather="info" class="w-3 h-3 mr-1"></i> | |
| <span>MediMate AI provides health information but doesn't replace professional medical advice.</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Health Tracking Section --> | |
| <div class="mt-12 bg-white bg-opacity-90 rounded-xl shadow-lg p-8"> | |
| <div class="flex items-center justify-between mb-6"> | |
| <h2 class="text-xl font-bold text-dark">Your Health Progress</h2> | |
| <button class="text-primary font-medium flex items-center"> | |
| <i data-feather="plus" class="mr-2"></i> | |
| Add Tracking | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> | |
| <!-- Activity Tracking --> | |
| <div class="bg-gray-50 rounded-lg p-6"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h3 class="font-semibold">Daily Activity</h3> | |
| <div class="relative w-16 h-16"> | |
| <svg class="w-full h-full" viewBox="0 0 36 36"> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#E5E7EB" | |
| stroke-width="3" | |
| stroke-dasharray="100, 100" /> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#10B981" | |
| stroke-width="3" | |
| stroke-dasharray="70, 100" /> | |
| <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#10B981">70%</text> | |
| </svg> | |
| </div> | |
| </div> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Steps</span> | |
| <span class="font-medium">6,843/10,000</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Active Minutes</span> | |
| <span class="font-medium">28/30</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Distance</span> | |
| <span class="font-medium">4.2/5 km</span> | |
| </div> | |
| </div> | |
| <button class="mt-4 w-full py-2 bg-primary bg-opacity-10 text-primary rounded-lg text-sm font-medium hover:bg-opacity-20 transition"> | |
| View Details | |
| </button> | |
| </div> | |
| <!-- Nutrition Tracking --> | |
| <div class="bg-gray-50 rounded-lg p-6"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h3 class="font-semibold">Daily Nutrition</h3> | |
| <div class="relative w-16 h-16"> | |
| <svg class="w-full h-full" viewBox="0 0 36 36"> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#E5E7EB" | |
| stroke-width="3" | |
| stroke-dasharray="100, 100" /> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#8B5CF6" | |
| stroke-width="3" | |
| stroke-dasharray="55, 100" /> | |
| <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#8B5CF6">55%</text> | |
| </svg> | |
| </div> | |
| </div> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Calories</span> | |
| <span class="font-medium">1,450/2,000</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Protein</span> | |
| <span class="font-medium">65/100g</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Water</span> | |
| <span class="font-medium">5/8 glasses</span> | |
| </div> | |
| </div> | |
| <button class="mt-4 w-full py-2 bg-accent bg-opacity-10 text-accent rounded-lg text-sm font-medium hover:bg-opacity-20 transition"> | |
| View Details | |
| </button> | |
| </div> | |
| <!-- Mental Health Tracking --> | |
| <div class="bg-gray-50 rounded-lg p-6"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h3 class="font-semibold">Mental Wellness</h3> | |
| <div class="relative w-16 h-16"> | |
| <svg class="w-full h-full" viewBox="0 0 36 36"> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#E5E7EB" | |
| stroke-width="3" | |
| stroke-dasharray="100, 100" /> | |
| <path d="M18 2.0845 | |
| a 15.9155 15.9155 0 0 1 0 31.831 | |
| a 15.9155 15.9155 0 0 1 0 -31.831" | |
| fill="none" | |
| stroke="#3B82F6" | |
| stroke-width="3" | |
| stroke-dasharray="40, 100" /> | |
| <text x="18" y="20.5" text-anchor="middle" font-size="10" fill="#3B82F6">40%</text> | |
| </svg> | |
| </div> | |
| </div> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Stress Level</span> | |
| <span class="font-medium">Medium</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Sleep Quality</span> | |
| <span class="font-medium">Fair</span> | |
| </div> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-sm">Meditation</span> | |
| <span class="font-medium">3/7 days</span> | |
| </div> | |
| </div> | |
| <button class="mt-4 w-full py-2 bg-primary bg-opacity-10 text-primary rounded-lg text-sm font-medium hover:bg-opacity-20 transition"> | |
| View Details | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="bg-dark text-white py-8 z-10"> | |
| <div class="container mx-auto px-4"> | |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> | |
| <div> | |
| <h3 class="text-lg font-semibold mb-4">MediMate AI</h3> | |
| <p class="text-gray-400 text-sm">Your personalized health companion providing AI-powered medical insights and wellness tracking.</p> | |
| </div> | |
| <div> | |
| <h4 class="text-md font-semibold mb-4">Quick Links</h4> | |
| <ul class="space-y-2 text-sm text-gray-400"> | |
| <li><a href="#" class="hover:text-white transition">Health Assessment</a></li> | |
| <li><a href="#" class="hover:text-white transition">Wellness Programs</a></li> | |
| <li><a href="#" class="hover:text-white transition">Medical Resources</a></li> | |
| <li><a href="#" class="hover:text-white transition">FAQ</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h4 class="text-md font-semibold mb-4">Legal</h4> | |
| <ul class="space-y-2 text-sm text-gray-400"> | |
| <li><a href="#" class="hover:text-white transition">Privacy Policy</a></li> | |
| <li><a href="#" class="hover:text-white transition">Terms of Service</a></li> | |
| <li><a href="#" class="hover:text-white transition">Medical Disclaimer</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h4 class="text-md font-semibold mb-4">Contact</h4> | |
| <ul class="space-y-2 text-sm text-gray-400"> | |
| <li class="flex items-center"> | |
| <i data-feather="mail" class="w-4 h-4 mr-2"></i> | |
| <span>support@medimate.ai</span> | |
| </li> | |
| <li class="flex items-center"> | |
| <i data-feather="phone" class="w-4 h-4 mr-2"></i> | |
| <span>+1 (555) 123-4567</span> | |
| </li> | |
| <li class="flex items-center"> | |
| <i data-feather="map-pin" class="w-4 h-4 mr-2"></i> | |
| <span>San Francisco, CA</span> | |
| </li> | |
| </ul> | |
| </div> | |
| </div> | |
| <div class="border-t border-gray-800 mt-8 pt-6 text-sm text-gray-400"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <p>© 2023 MediMate AI. All rights reserved.</p> | |
| <div class="flex space-x-4 mt-4 md:mt-0"> | |
| <a href="#" class="hover:text-white transition"><i data-feather="facebook"></i></a> | |
| <a href="#" class="hover:text-white transition"><i data-feather="twitter"></i></a> | |
| <a href="#" class="hover:text-white transition"><i data-feather="instagram"></i></a> | |
| <a href="#" class="hover:text-white transition"><i data-feather="linkedin"></i></a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </footer> | |
| </div> | |
| <script> | |
| // Initialize Vanta.js background | |
| VANTA.WAVES({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x3b82f6, | |
| shininess: 35.00, | |
| waveHeight: 15.00, | |
| waveSpeed: 0.75, | |
| zoom: 0.85 | |
| }); | |
| // Initialize Feather Icons | |
| feather.replace(); | |
| // Chat functionality | |
| const chatContainer = document.querySelector('.chat-container'); | |
| const chatForm = document.querySelector('form'); | |
| const chatInput = chatForm.querySelector('input'); | |
| chatForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| const message = chatInput.value.trim(); | |
| if (message) { | |
| // Add user message | |
| addMessage(message, 'user'); | |
| chatInput.value = ''; | |
| // Show typing indicator | |
| showTypingIndicator(); | |
| // Simulate AI response after delay | |
| setTimeout(() => { | |
| removeTypingIndicator(); | |
| const aiResponse = getAIResponse(message); | |
| addMessage(aiResponse, 'ai'); | |
| scrollToBottom(); | |
| }, 1500); | |
| } | |
| }); | |
| function addMessage(text, sender) { | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`; | |
| const messageContent = document.createElement('div'); | |
| messageContent.className = sender === 'user' | |
| ? 'bg-primary text-white rounded-lg p-4 max-w-xs lg:max-w-md' | |
| : 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md'; | |
| messageContent.innerHTML = `<p>${text}</p>`; | |
| messageDiv.appendChild(messageContent); | |
| chatContainer.appendChild(messageDiv); | |
| scrollToBottom(); | |
| } | |
| function showTypingIndicator() { | |
| const typingDiv = document.createElement('div'); | |
| typingDiv.className = 'flex justify-start'; | |
| typingDiv.id = 'typing-indicator'; | |
| const typingContent = document.createElement('div'); | |
| typingContent.className = 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md'; | |
| typingContent.innerHTML = ` | |
| <div class="typing-indicator flex items-center"> | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| </div> | |
| `; | |
| typingDiv.appendChild(typingContent); | |
| chatContainer.appendChild(typingDiv); | |
| scrollToBottom(); | |
| } | |
| function removeTypingIndicator() { | |
| const typingIndicator = document.getElementById('typing-indicator'); | |
| if (typingIndicator) { | |
| typingIndicator.remove(); | |
| } | |
| } | |
| function scrollToBottom() { | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| } | |
| // Enhanced AI response with tracking capabilities | |
| function getAIResponse(userMessage) { | |
| const userData = { | |
| weight: 72, | |
| height: 175, | |
| bloodPressure: "120/80", | |
| lastCheckup: "2023-03-15", | |
| medications: ["Vitamin D3", "Omega-3 Fish Oil"] | |
| }; | |
| userMessage = userMessage.toLowerCase(); | |
| let response = ""; | |
| let actionButtons = ""; | |
| if (userMessage.includes("headache")) { | |
| response = `Based on your health profile (BP: ${userData.bloodPressure}, Weight: ${userData.weight}kg), headaches could be caused by:\n1. Stress (your last checkup was ${getDaysSince(userData.lastCheckup)} days ago)\n2. Dehydration\n3. Eye strain from screens\n\nRecommendations:\n1. Drink 2L water daily (currently tracking)\n2. Practice 5-min deep breathing 3x/day\n3. Take screen breaks every 30 mins`; | |
| actionButtons = `<div class="mt-4 flex flex-wrap gap-2"> | |
| <button onclick="trackRecommendation('water')" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm flex items-center"> | |
| <i data-feather="droplet" class="w-3 h-3 mr-1"></i> Track Water | |
| </button> | |
| <button onclick="startBreathingExercise()" class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm flex items-center"> | |
| <i data-feather="activity" class="w-3 h-3 mr-1"></i> Start Breathing | |
| </button> | |
| <button onclick="showReminderSettings()" class="bg-purple-100 text-purple-800 px-3 py-1 rounded-full text-sm flex items-center"> | |
| <i data-feather="clock" class="w-3 h-3 mr-1"></i> Set Reminders | |
| </button> | |
| </div>`; | |
| } | |
| else if (userMessage.includes("sleep")) { | |
| response = `Sleep is crucial for recovery. Based on your activity data:\n1. Aim for 7-8 hours nightly\n2. Try going to bed by 10:30PM\n3. Limit caffeine after 2PM\n\nI can help track your sleep patterns and suggest wind-down routines.`; | |
| actionButtons = `<div class="mt-4 flex flex-wrap gap-2"> | |
| <button onclick="trackSleep()" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm flex items-center"> | |
| <i data-feather="moon" class="w-3 h-3 mr-1"></i> Log Sleep | |
| </button> | |
| <button onclick="showSleepGuide()" class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm flex items-center"> | |
| <i data-feather="book-open" class="w-3 h-3 mr-1"></i> Sleep Guide | |
| </button> | |
| </div>`; | |
| } | |
| else { | |
| response = "I'm analyzing your health profile to give personalized advice. Could you share more details about your concern?"; | |
| } | |
| return {text: response, buttons: actionButtons}; | |
| } | |
| // Helper function to get days since last checkup | |
| function getDaysSince(dateString) { | |
| const oneDay = 24 * 60 * 60 * 1000; | |
| const lastDate = new Date(dateString); | |
| const today = new Date(); | |
| return Math.round(Math.abs((today - lastDate) / oneDay)); | |
| } | |
| // Tracking functions | |
| function trackRecommendation(type) { | |
| addSystemMessage(`Started tracking your ${type} intake. I'll check in with you daily.`); | |
| // In a real app, would connect to backend tracking system | |
| } | |
| function startBreathingExercise() { | |
| addSystemMessage(`Let's begin a 5-minute breathing exercise. Breathe in... (2 sec) Hold... (2 sec) Breathe out... (4 sec)`); | |
| // Would trigger guided breathing animation | |
| } | |
| function addSystemMessage(text) { | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = 'flex justify-start'; | |
| const messageContent = document.createElement('div'); | |
| messageContent.className = 'bg-gray-100 rounded-lg p-4 max-w-xs lg:max-w-md'; | |
| messageContent.innerHTML = `<p>${text}</p>`; | |
| messageDiv.appendChild(messageContent); | |
| document.getElementById('chat-container').appendChild(messageDiv); | |
| scrollToBottom(); | |
| } | |
| </script> | |
| </body> | |
| </html> | |