File size: 9,805 Bytes
e5d8293 f10046f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MediSearch AI - Medical Knowledge Assistant</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.typewriter { overflow: hidden; border-right: .15em solid #3b82f6; white-space: pre-wrap; letter-spacing: .15em; animation: typing 3.5s steps(40,end), blink-caret .75s step-end infinite; }
@keyframes typing { from { width: 0 } to { width: 100% } }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: #3b82f6; } }
.medical-card { transition: all 0.3s ease; }
.medical-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
</style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="container mx-auto px-4 py-6 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-heartbeat text-3xl text-blue-600"></i>
<h1 class="text-2xl font-bold text-gray-800">MediSearch<span class="text-blue-600">AI</span></h1>
</div>
<nav class="hidden md:flex space-x-8">
<a href="#" class="text-gray-700 hover:text-blue-600 font-medium">Home</a>
<a href="#" class="text-gray-700 hover:text-blue-600 font-medium">Drug Database</a>
<a href="#" class="text-gray-700 hover:text-blue-600 font-medium">Medical News</a>
<a href="#" class="text-gray-700 hover:text-blue-600 font-medium">About</a>
</nav>
<button class="md:hidden text-gray-700"><i class="fas fa-bars text-2xl"></i></button>
</div>
</header>
<!-- Chat Interface -->
<section class="bg-gradient-to-r from-blue-500 to-blue-700 text-white py-12">
<div class="container mx-auto px-4">
<h1 class="text-4xl md:text-5xl font-bold mb-6 text-center">MediSearch AI Assistant</h1>
<div class="max-w-4xl mx-auto bg-white rounded-xl shadow-xl overflow-hidden">
<!-- Chat Header -->
<div class="bg-gray-800 text-white px-6 py-4 flex items-center">
<div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
<div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<div class="ml-auto text-sm">MediSearch AI v2.5</div>
</div>
<!-- Chat Messages Container -->
<div id="chatContainer" class="h-96 overflow-y-auto p-6 space-y-4">
<div class="flex justify-start">
<div class="bg-blue-100 rounded-lg p-4 max-w-3xl">
<p class="text-gray-800">Hello! I'm your AI medical assistant. I can provide information on:</p>
<ul class="list-disc list-inside mt-2 space-y-1">
<li>Latest medical research and drug approvals</li>
<li>Disease symptoms and treatments</li>
<li>Medication information and interactions</li>
<li>Clinical guidelines and protocols</li>
</ul>
<p class="mt-2 text-gray-800">How can I help you today?</p>
</div>
</div>
</div>
<!-- Chat Input -->
<div class="border-t border-gray-200 p-4 bg-gray-50">
<div class="flex">
<input type="text" id="userInput" placeholder="Ask your medical question..."
class="flex-grow border border-gray-300 rounded-l-lg py-3 px-4 focus:outline-none focus:ring-2 focus:ring-blue-500">
<button id="sendButton" class="bg-blue-600 text-white py-3 px-6 rounded-r-lg hover:bg-blue-700 transition duration-300">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<p class="text-xs text-gray-500 mt-2">Disclaimer: This is for informational purposes only. Always consult a healthcare professional.</p>
</div>
</div>
</div>
</section>
<!-- Scripts -->
<script>
document.addEventListener('DOMContentLoaded', () => {
// Disclaimer modal handling
const disclaimerModal = document.getElementById('disclaimerModal');
if (!localStorage.getItem('disclaimerAccepted')) {
disclaimerModal.classList.remove('hidden');
}
document.getElementById('closeModal').addEventListener('click', () => disclaimerModal.classList.add('hidden'));
document.getElementById('acceptDisclaimer').addEventListener('click', () => {
localStorage.setItem('disclaimerAccepted', 'true');
disclaimerModal.classList.add('hidden');
});
// Chat functionality
const chatContainer = document.getElementById('chatContainer');
const userInput = document.getElementById('userInput');
const sendButton = document.getElementById('sendButton');
const API_KEY = 'AIzaSyBD-z8Y7oPhSV5fIS5DmBWoixpxMILnZNQ'; // Replace with actual API key
const localKnowledgeBase = {
"covid symptoms": "Common COVID-19 symptoms include fever, cough, fatigue, loss of taste or smell. Severe cases may have difficulty breathing. Source: WHO",
"ibuprofen dosage": "Typical adult dose is 200-400mg every 4-6 hours, not exceeding 1200mg in 24 hours. Always follow package instructions. Source: FDA",
"high blood pressure": "Hypertension is defined as 130/80 mmHg or higher. Lifestyle changes and medications can help manage it. Source: American Heart Association",
"diabetes types": "Type 1 (autoimmune), Type 2 (insulin resistance), gestational (during pregnancy). Source: CDC",
"heart attack signs": "Chest pain, shortness of breath, nausea, pain in arms/back/neck/jaw. Call emergency services immediately. Source: American Heart Association"
};
function addMessage(text, isUser=false) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex ${isUser ? 'justify-end' : 'justify-start'}`;
const contentDiv = document.createElement('div');
contentDiv.className = isUser ? 'bg-blue-600 text-white rounded-lg p-4 max-w-3xl' : 'bg-blue-100 rounded-lg p-4 max-w-3xl';
contentDiv.innerHTML = text;
messageDiv.appendChild(contentDiv);
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
const typingDiv = document.createElement('div');
typingDiv.className = 'flex justify-start';
typingDiv.id = 'typingIndicator';
typingDiv.innerHTML = `<div class="bg-gray-100 rounded-lg p-4 max-w-xs"><div class="flex space-x-2">
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce"></div>
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style="animation-delay:0.2s"></div>
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style="animation-delay:0.4s"></div>
</div></div>`;
function showTyping() { chatContainer.appendChild(typingDiv); chatContainer.scrollTop = chatContainer.scrollHeight; }
function hideTyping() { if (typingDiv.parentNode) typingDiv.parentNode.removeChild(typingDiv); }
async function processInput() {
const question = userInput.value.trim();
if (!question) return;
addMessage(question, true);
userInput.value = '';
// Check local knowledge
const answerEntry = Object.entries(localKnowledgeBase).find(([key]) => question.toLowerCase().includes(key));
if (answerEntry) { addMessage(answerEntry[1]); return; }
// Search via API
try {
showTyping();
const response = await fetch("https://gemini.googleapis.com/v1/models/flash-2.0:generateText", {
method: "POST",
headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ prompt: question, maxOutputTokens: 500 })
});
const data = await response.json();
hideTyping();
if (data?.candidates?.[0]?.output) addMessage(data.candidates[0].output);
else addMessage("Couldn't find a specific answer. Please try rephrasing.");
} catch (err) {
hideTyping();
addMessage("Error accessing medical resources. Try again later.");
console.error(err);
}
}
sendButton.addEventListener('click', processInput);
userInput.addEventListener('keypress', (e) => { if(e.key==='Enter') processInput(); });
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=biswaaa/dipesh" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
|