gimme correct working code
Browse files- index.html +40 -1
- style.css +49 -18
index.html
CHANGED
|
@@ -209,6 +209,45 @@
|
|
| 209 |
"hi": "Hi there! What AI concept would you like to explore?",
|
| 210 |
"explain backpropagation": "Backpropagation is the algorithm used to train neural networks. It works by:\n1. Forward pass: Compute predictions\n2. Calculate loss\n3. Backward pass: Compute gradients\n4. Update weights using gradient descent\n\nIt's called 'back' propagation because gradients flow backward through the network from output to input layers.",
|
| 211 |
"show python ml example": "Here's a simple linear regression example using scikit-learn:\n
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
</body>
|
| 214 |
</html>
|
|
|
|
| 209 |
"hi": "Hi there! What AI concept would you like to explore?",
|
| 210 |
"explain backpropagation": "Backpropagation is the algorithm used to train neural networks. It works by:\n1. Forward pass: Compute predictions\n2. Calculate loss\n3. Backward pass: Compute gradients\n4. Update weights using gradient descent\n\nIt's called 'back' propagation because gradients flow backward through the network from output to input layers.",
|
| 211 |
"show python ml example": "Here's a simple linear regression example using scikit-learn:\n
|
| 212 |
+
// Send message when Enter is pressed
|
| 213 |
+
userInput.addEventListener('keypress', (e) => {
|
| 214 |
+
if (e.key === 'Enter') {
|
| 215 |
+
sendMessage();
|
| 216 |
+
}
|
| 217 |
+
});
|
| 218 |
+
|
| 219 |
+
// Send button click handler
|
| 220 |
+
sendButton.addEventListener('click', sendMessage);
|
| 221 |
+
|
| 222 |
+
// Quick prompt buttons
|
| 223 |
+
quickPrompts.forEach(button => {
|
| 224 |
+
button.addEventListener('click', () => {
|
| 225 |
+
userInput.value = button.textContent;
|
| 226 |
+
sendMessage();
|
| 227 |
+
});
|
| 228 |
+
});
|
| 229 |
+
|
| 230 |
+
async function sendMessage() {
|
| 231 |
+
const message = userInput.value.trim();
|
| 232 |
+
if (!message) return;
|
| 233 |
+
|
| 234 |
+
addUserMessage(message);
|
| 235 |
+
userInput.value = '';
|
| 236 |
+
|
| 237 |
+
const typingIndicator = addBotMessage('', true);
|
| 238 |
+
|
| 239 |
+
// Simulate API delay
|
| 240 |
+
setTimeout(async () => {
|
| 241 |
+
const response = await getBotResponse(message);
|
| 242 |
+
chatMessages.removeChild(typingIndicator);
|
| 243 |
+
addBotMessage(response);
|
| 244 |
+
}, 1000 + Math.random() * 2000);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Initialize Feather Icons
|
| 248 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 249 |
+
feather.replace();
|
| 250 |
+
});
|
| 251 |
+
</script>
|
| 252 |
</body>
|
| 253 |
</html>
|
style.css
CHANGED
|
@@ -1,28 +1,59 @@
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
margin-top: 0;
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
+
margin: 0;
|
| 3 |
+
padding: 0;
|
| 4 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
| 5 |
}
|
| 6 |
|
| 7 |
+
.chat-container {
|
| 8 |
+
height: calc(100vh - 180px);
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
+
.chat-message {
|
| 12 |
+
animation: fadeIn 0.3s ease-in-out;
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
|
| 15 |
+
@keyframes fadeIn {
|
| 16 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 17 |
+
to { opacity: 1; transform: translateY(0); }
|
|
|
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
+
.typing-indicator::after {
|
| 21 |
+
content: '...';
|
| 22 |
+
animation: typing 1.5s infinite;
|
| 23 |
}
|
| 24 |
+
|
| 25 |
+
@keyframes typing {
|
| 26 |
+
0% { content: '.'; }
|
| 27 |
+
33% { content: '..'; }
|
| 28 |
+
66% { content: '...'; }
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.gradient-bg {
|
| 32 |
+
background: linear-gradient(135deg, rgba(217, 70, 239, 0.2) 0%, rgba(234, 179, 8, 0.2) 100%);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/* Dark mode specific styles */
|
| 36 |
+
.dark {
|
| 37 |
+
background-color: #111827;
|
| 38 |
+
color: #f3f4f6;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.dark .bg-gray-800 {
|
| 42 |
+
background-color: #1f2937;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.dark .bg-gray-700 {
|
| 46 |
+
background-color: #374151;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.dark .bg-gray-600 {
|
| 50 |
+
background-color: #4b5563;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.dark .text-gray-300 {
|
| 54 |
+
color: #d1d5db;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.dark .border-gray-600 {
|
| 58 |
+
border-color: #4b5563;
|
| 59 |
+
}
|