Spaces:
Running
Running
Update index.html
Browse files- index.html +203 -67
index.html
CHANGED
|
@@ -146,25 +146,50 @@
|
|
| 146 |
transform: rotate(90deg);
|
| 147 |
}
|
| 148 |
|
| 149 |
-
/* Chat Interface -
|
| 150 |
.chat-overlay {
|
| 151 |
position: absolute;
|
| 152 |
-
|
| 153 |
left: 50%;
|
| 154 |
-
transform:
|
| 155 |
-
width:
|
| 156 |
-
max-width:
|
| 157 |
background: rgba(20, 20, 30, 0.85);
|
| 158 |
backdrop-filter: blur(20px);
|
| 159 |
border-radius: 20px;
|
| 160 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 161 |
-
box-shadow: 0
|
| 162 |
z-index: 100;
|
| 163 |
display: flex;
|
| 164 |
flex-direction: column;
|
| 165 |
overflow: hidden;
|
| 166 |
opacity: 0;
|
| 167 |
animation: fadeIn 0.5s ease 1s forwards;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
|
| 170 |
@keyframes fadeIn {
|
|
@@ -174,103 +199,152 @@
|
|
| 174 |
}
|
| 175 |
|
| 176 |
.chat-header {
|
| 177 |
-
padding:
|
| 178 |
background: rgba(25, 25, 40, 0.9);
|
| 179 |
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
}
|
| 181 |
|
| 182 |
.chat-title {
|
| 183 |
display: flex;
|
| 184 |
align-items: center;
|
| 185 |
gap: 15px;
|
| 186 |
-
margin-bottom: 10px;
|
| 187 |
}
|
| 188 |
|
| 189 |
.chat-title h2 {
|
| 190 |
color: #a0b0ff;
|
| 191 |
font-weight: 400;
|
| 192 |
-
font-size: 1.
|
| 193 |
}
|
| 194 |
|
| 195 |
.ai-avatar {
|
| 196 |
-
width:
|
| 197 |
-
height:
|
| 198 |
background: linear-gradient(135deg, #5a6cff, #00ff9d);
|
| 199 |
border-radius: 50%;
|
| 200 |
display: flex;
|
| 201 |
align-items: center;
|
| 202 |
justify-content: center;
|
| 203 |
-
font-size: 1.
|
| 204 |
}
|
| 205 |
|
| 206 |
.chat-subtitle {
|
| 207 |
color: #8892b0;
|
| 208 |
-
font-size: 0.
|
| 209 |
line-height: 1.5;
|
| 210 |
}
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
.chat-messages {
|
| 213 |
-
flex: 1;
|
| 214 |
-
padding: 25px;
|
| 215 |
-
overflow-y: auto;
|
| 216 |
-
max-height: 400px;
|
| 217 |
display: flex;
|
| 218 |
-
flex-direction:
|
| 219 |
-
gap:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
}
|
| 221 |
|
| 222 |
.message {
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
|
|
|
| 227 |
position: relative;
|
| 228 |
animation: messageAppear 0.3s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
@keyframes messageAppear {
|
| 232 |
from {
|
| 233 |
opacity: 0;
|
| 234 |
-
transform:
|
| 235 |
}
|
| 236 |
to {
|
| 237 |
opacity: 1;
|
| 238 |
-
transform:
|
| 239 |
}
|
| 240 |
}
|
| 241 |
|
| 242 |
.message-user {
|
| 243 |
-
align-self: flex-end;
|
| 244 |
background: linear-gradient(135deg, #5a6cff, #7a8aff);
|
| 245 |
color: white;
|
| 246 |
-
border-bottom-right-radius: 5px;
|
| 247 |
}
|
| 248 |
|
| 249 |
.message-ai {
|
| 250 |
-
align-self: flex-start;
|
| 251 |
background: rgba(255, 255, 255, 0.08);
|
| 252 |
color: #e0e0ff;
|
| 253 |
-
border-bottom-left-radius: 5px;
|
| 254 |
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 255 |
}
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
.message-time {
|
| 258 |
-
font-size: 0.
|
| 259 |
opacity: 0.7;
|
| 260 |
-
margin-top: 8px;
|
| 261 |
text-align: right;
|
| 262 |
}
|
| 263 |
|
| 264 |
.message-typing {
|
| 265 |
-
|
| 266 |
-
align-items: center;
|
| 267 |
-
gap: 5px;
|
| 268 |
padding: 15px;
|
| 269 |
background: rgba(255, 255, 255, 0.05);
|
| 270 |
-
border-radius:
|
| 271 |
-
|
| 272 |
-
align-
|
| 273 |
-
|
| 274 |
}
|
| 275 |
|
| 276 |
.typing-dot {
|
|
@@ -290,7 +364,7 @@
|
|
| 290 |
}
|
| 291 |
|
| 292 |
.chat-input-container {
|
| 293 |
-
padding:
|
| 294 |
background: rgba(15, 15, 25, 0.9);
|
| 295 |
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
| 296 |
}
|
|
@@ -305,14 +379,14 @@
|
|
| 305 |
flex: 1;
|
| 306 |
background: rgba(255, 255, 255, 0.07);
|
| 307 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 308 |
-
border-radius:
|
| 309 |
-
padding: 18px
|
| 310 |
color: white;
|
| 311 |
font-family: 'Segoe UI', system-ui, sans-serif;
|
| 312 |
-
font-size:
|
| 313 |
resize: none;
|
| 314 |
-
min-height:
|
| 315 |
-
max-height:
|
| 316 |
transition: all 0.3s ease;
|
| 317 |
}
|
| 318 |
|
|
@@ -329,15 +403,14 @@
|
|
| 329 |
|
| 330 |
.input-buttons {
|
| 331 |
display: flex;
|
| 332 |
-
flex-direction: column;
|
| 333 |
gap: 8px;
|
| 334 |
}
|
| 335 |
|
| 336 |
.voice-input-btn,
|
| 337 |
.send-btn {
|
| 338 |
-
width:
|
| 339 |
-
height:
|
| 340 |
-
border-radius:
|
| 341 |
background: linear-gradient(135deg, #5a6cff, #7a8aff);
|
| 342 |
border: none;
|
| 343 |
color: white;
|
|
@@ -346,7 +419,7 @@
|
|
| 346 |
align-items: center;
|
| 347 |
justify-content: center;
|
| 348 |
transition: all 0.3s ease;
|
| 349 |
-
font-size: 1.
|
| 350 |
}
|
| 351 |
|
| 352 |
.voice-input-btn:hover,
|
|
@@ -674,7 +747,11 @@
|
|
| 674 |
/* Responsive Design */
|
| 675 |
@media (max-width: 1200px) {
|
| 676 |
.chat-overlay {
|
| 677 |
-
width:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 678 |
}
|
| 679 |
}
|
| 680 |
|
|
@@ -707,13 +784,27 @@
|
|
| 707 |
|
| 708 |
.chat-overlay {
|
| 709 |
width: 95%;
|
| 710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 711 |
}
|
| 712 |
}
|
| 713 |
|
| 714 |
/* Scrollbar Styling */
|
| 715 |
::-webkit-scrollbar {
|
| 716 |
width: 8px;
|
|
|
|
| 717 |
}
|
| 718 |
|
| 719 |
::-webkit-scrollbar-track {
|
|
@@ -906,8 +997,8 @@
|
|
| 906 |
<span id="statusText">Neural AI Tutor Ready</span>
|
| 907 |
</div>
|
| 908 |
|
| 909 |
-
<!-- Centered Chat Interface -->
|
| 910 |
-
<div class="chat-overlay">
|
| 911 |
<div class="chat-header">
|
| 912 |
<div class="chat-title">
|
| 913 |
<div class="ai-avatar">
|
|
@@ -920,6 +1011,12 @@
|
|
| 920 |
</div>
|
| 921 |
</div>
|
| 922 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
</div>
|
| 924 |
|
| 925 |
<div class="chat-messages" id="chatMessages">
|
|
@@ -927,7 +1024,6 @@
|
|
| 927 |
<div class="message-content">
|
| 928 |
Welcome to the Neural AI Tutor! I'm your interactive learning assistant.
|
| 929 |
I can help explain complex concepts, answer questions, and guide your learning journey.
|
| 930 |
-
What would you like to learn about today?
|
| 931 |
</div>
|
| 932 |
<div class="message-time">Just now</div>
|
| 933 |
</div>
|
|
@@ -940,11 +1036,20 @@
|
|
| 940 |
<div class="message-time">Just now</div>
|
| 941 |
</div>
|
| 942 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
<!-- Typing indicator (hidden by default) -->
|
| 944 |
<div class="message-typing" id="typingIndicator" style="display: none;">
|
| 945 |
<div class="typing-dot"></div>
|
| 946 |
<div class="typing-dot"></div>
|
| 947 |
<div class="typing-dot"></div>
|
|
|
|
| 948 |
</div>
|
| 949 |
</div>
|
| 950 |
|
|
@@ -999,6 +1104,37 @@
|
|
| 999 |
chevron.classList.toggle('rotated');
|
| 1000 |
}
|
| 1001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1002 |
// Check if Three.js loaded properly
|
| 1003 |
function checkThreeJS() {
|
| 1004 |
if (typeof THREE === 'undefined') {
|
|
@@ -1032,7 +1168,7 @@
|
|
| 1032 |
document.getElementById('loadingText').textContent = text;
|
| 1033 |
}
|
| 1034 |
|
| 1035 |
-
// Voice Synthesis System
|
| 1036 |
class VoiceSynthesis {
|
| 1037 |
constructor() {
|
| 1038 |
this.synth = window.speechSynthesis;
|
|
@@ -1356,7 +1492,7 @@
|
|
| 1356 |
}
|
| 1357 |
}
|
| 1358 |
|
| 1359 |
-
// Chat Interface Functionality
|
| 1360 |
class ChatInterface {
|
| 1361 |
constructor() {
|
| 1362 |
this.isListening = false;
|
|
@@ -1396,7 +1532,7 @@
|
|
| 1396 |
autoResizeTextarea() {
|
| 1397 |
const textarea = this.chatInput;
|
| 1398 |
textarea.style.height = 'auto';
|
| 1399 |
-
const newHeight = Math.min(textarea.scrollHeight,
|
| 1400 |
textarea.style.height = newHeight + 'px';
|
| 1401 |
}
|
| 1402 |
|
|
@@ -1485,8 +1621,8 @@
|
|
| 1485 |
|
| 1486 |
this.chatMessages.appendChild(messageDiv);
|
| 1487 |
|
| 1488 |
-
// Scroll to
|
| 1489 |
-
this.chatMessages.
|
| 1490 |
|
| 1491 |
// Update 3D visualization
|
| 1492 |
if (window.visualization) {
|
|
@@ -1546,7 +1682,7 @@
|
|
| 1546 |
|
| 1547 |
showTypingIndicator() {
|
| 1548 |
this.typingIndicator.style.display = 'flex';
|
| 1549 |
-
this.chatMessages.
|
| 1550 |
}
|
| 1551 |
|
| 1552 |
hideTypingIndicator() {
|
|
@@ -1556,12 +1692,12 @@
|
|
| 1556 |
generateAIResponse(userMessage) {
|
| 1557 |
// Enhanced AI response generator with educational content
|
| 1558 |
const responses = {
|
| 1559 |
-
quantum: "Quantum computing uses quantum bits or 'qubits' that can exist in multiple states simultaneously (superposition). This allows quantum computers to process vast amounts of data in parallel. Unlike classical bits (0 or 1), qubits can be 0, 1, or both at the same time.
|
| 1560 |
-
neural: "Neural networks learn through
|
| 1561 |
-
ai: "Artificial Intelligence (AI) is the broader concept of machines being able to carry out tasks in a way we would consider 'smart'. Machine Learning (ML) is a subset of AI where machines learn from data without explicit programming.
|
| 1562 |
-
blockchain: "Blockchain is a distributed, decentralized digital ledger that records transactions across many computers. Each 'block' contains a cryptographic hash of the previous block,
|
| 1563 |
-
calculus: "Derivatives measure instantaneous rate of change - essentially the slope of a curve at a specific point. If f(x) is your function, the derivative f'(x) tells you how fast f(x) is changing at any x.
|
| 1564 |
-
default: "I understand you're asking about " + userMessage.substring(0,
|
| 1565 |
};
|
| 1566 |
|
| 1567 |
const lowerMessage = userMessage.toLowerCase();
|
|
@@ -1576,7 +1712,7 @@
|
|
| 1576 |
}
|
| 1577 |
}
|
| 1578 |
|
| 1579 |
-
// Main Visualization Class (
|
| 1580 |
class AITutorVisualization {
|
| 1581 |
constructor() {
|
| 1582 |
if (!checkThreeJS()) return;
|
|
|
|
| 146 |
transform: rotate(90deg);
|
| 147 |
}
|
| 148 |
|
| 149 |
+
/* Chat Interface - Horizontal and Centered */
|
| 150 |
.chat-overlay {
|
| 151 |
position: absolute;
|
| 152 |
+
bottom: 30px;
|
| 153 |
left: 50%;
|
| 154 |
+
transform: translateX(-50%);
|
| 155 |
+
width: 800px;
|
| 156 |
+
max-width: 85vw;
|
| 157 |
background: rgba(20, 20, 30, 0.85);
|
| 158 |
backdrop-filter: blur(20px);
|
| 159 |
border-radius: 20px;
|
| 160 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 161 |
+
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
|
| 162 |
z-index: 100;
|
| 163 |
display: flex;
|
| 164 |
flex-direction: column;
|
| 165 |
overflow: hidden;
|
| 166 |
opacity: 0;
|
| 167 |
animation: fadeIn 0.5s ease 1s forwards;
|
| 168 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.chat-overlay.collapsed {
|
| 172 |
+
width: 400px;
|
| 173 |
+
height: 70px;
|
| 174 |
+
bottom: 20px;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.chat-overlay.collapsed .chat-header {
|
| 178 |
+
border-radius: 15px;
|
| 179 |
+
padding: 15px;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.chat-overlay.collapsed .chat-messages,
|
| 183 |
+
.chat-overlay.collapsed .chat-input-container {
|
| 184 |
+
display: none;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
.chat-overlay.collapsed .chat-header {
|
| 188 |
+
cursor: pointer;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
.chat-overlay.collapsed .chat-header:hover {
|
| 192 |
+
background: rgba(35, 35, 50, 0.9);
|
| 193 |
}
|
| 194 |
|
| 195 |
@keyframes fadeIn {
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
.chat-header {
|
| 202 |
+
padding: 20px;
|
| 203 |
background: rgba(25, 25, 40, 0.9);
|
| 204 |
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
| 205 |
+
display: flex;
|
| 206 |
+
align-items: center;
|
| 207 |
+
justify-content: space-between;
|
| 208 |
+
transition: all 0.3s ease;
|
| 209 |
}
|
| 210 |
|
| 211 |
.chat-title {
|
| 212 |
display: flex;
|
| 213 |
align-items: center;
|
| 214 |
gap: 15px;
|
|
|
|
| 215 |
}
|
| 216 |
|
| 217 |
.chat-title h2 {
|
| 218 |
color: #a0b0ff;
|
| 219 |
font-weight: 400;
|
| 220 |
+
font-size: 1.3em;
|
| 221 |
}
|
| 222 |
|
| 223 |
.ai-avatar {
|
| 224 |
+
width: 40px;
|
| 225 |
+
height: 40px;
|
| 226 |
background: linear-gradient(135deg, #5a6cff, #00ff9d);
|
| 227 |
border-radius: 50%;
|
| 228 |
display: flex;
|
| 229 |
align-items: center;
|
| 230 |
justify-content: center;
|
| 231 |
+
font-size: 1.3em;
|
| 232 |
}
|
| 233 |
|
| 234 |
.chat-subtitle {
|
| 235 |
color: #8892b0;
|
| 236 |
+
font-size: 0.85em;
|
| 237 |
line-height: 1.5;
|
| 238 |
}
|
| 239 |
|
| 240 |
+
.chat-controls {
|
| 241 |
+
display: flex;
|
| 242 |
+
gap: 10px;
|
| 243 |
+
align-items: center;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
.collapse-btn {
|
| 247 |
+
width: 36px;
|
| 248 |
+
height: 36px;
|
| 249 |
+
border-radius: 10px;
|
| 250 |
+
background: rgba(255, 255, 255, 0.07);
|
| 251 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 252 |
+
color: #a0b0ff;
|
| 253 |
+
cursor: pointer;
|
| 254 |
+
display: flex;
|
| 255 |
+
align-items: center;
|
| 256 |
+
justify-content: center;
|
| 257 |
+
transition: all 0.3s ease;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.collapse-btn:hover {
|
| 261 |
+
background: rgba(90, 108, 255, 0.2);
|
| 262 |
+
transform: translateY(-2px);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
.chat-messages {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
display: flex;
|
| 267 |
+
flex-direction: row;
|
| 268 |
+
gap: 15px;
|
| 269 |
+
padding: 20px;
|
| 270 |
+
overflow-x: auto;
|
| 271 |
+
overflow-y: hidden;
|
| 272 |
+
height: 160px;
|
| 273 |
+
scrollbar-width: thin;
|
| 274 |
+
scrollbar-color: #5a6cff rgba(255, 255, 255, 0.05);
|
| 275 |
+
white-space: nowrap;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.chat-messages::-webkit-scrollbar {
|
| 279 |
+
height: 6px;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
.chat-messages::-webkit-scrollbar-track {
|
| 283 |
+
background: rgba(255, 255, 255, 0.05);
|
| 284 |
+
border-radius: 3px;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
.chat-messages::-webkit-scrollbar-thumb {
|
| 288 |
+
background: #5a6cff;
|
| 289 |
+
border-radius: 3px;
|
| 290 |
}
|
| 291 |
|
| 292 |
.message {
|
| 293 |
+
min-width: 280px;
|
| 294 |
+
max-width: 350px;
|
| 295 |
+
padding: 15px;
|
| 296 |
+
border-radius: 15px;
|
| 297 |
+
line-height: 1.4;
|
| 298 |
position: relative;
|
| 299 |
animation: messageAppear 0.3s ease;
|
| 300 |
+
white-space: normal;
|
| 301 |
+
word-wrap: break-word;
|
| 302 |
+
display: inline-block;
|
| 303 |
+
vertical-align: top;
|
| 304 |
+
margin-right: 15px;
|
| 305 |
}
|
| 306 |
|
| 307 |
@keyframes messageAppear {
|
| 308 |
from {
|
| 309 |
opacity: 0;
|
| 310 |
+
transform: translateX(-20px);
|
| 311 |
}
|
| 312 |
to {
|
| 313 |
opacity: 1;
|
| 314 |
+
transform: translateX(0);
|
| 315 |
}
|
| 316 |
}
|
| 317 |
|
| 318 |
.message-user {
|
|
|
|
| 319 |
background: linear-gradient(135deg, #5a6cff, #7a8aff);
|
| 320 |
color: white;
|
|
|
|
| 321 |
}
|
| 322 |
|
| 323 |
.message-ai {
|
|
|
|
| 324 |
background: rgba(255, 255, 255, 0.08);
|
| 325 |
color: #e0e0ff;
|
|
|
|
| 326 |
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 327 |
}
|
| 328 |
|
| 329 |
+
.message-content {
|
| 330 |
+
font-size: 0.95em;
|
| 331 |
+
margin-bottom: 8px;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
.message-time {
|
| 335 |
+
font-size: 0.7em;
|
| 336 |
opacity: 0.7;
|
|
|
|
| 337 |
text-align: right;
|
| 338 |
}
|
| 339 |
|
| 340 |
.message-typing {
|
| 341 |
+
min-width: 280px;
|
|
|
|
|
|
|
| 342 |
padding: 15px;
|
| 343 |
background: rgba(255, 255, 255, 0.05);
|
| 344 |
+
border-radius: 15px;
|
| 345 |
+
display: flex;
|
| 346 |
+
align-items: center;
|
| 347 |
+
gap: 8px;
|
| 348 |
}
|
| 349 |
|
| 350 |
.typing-dot {
|
|
|
|
| 364 |
}
|
| 365 |
|
| 366 |
.chat-input-container {
|
| 367 |
+
padding: 20px;
|
| 368 |
background: rgba(15, 15, 25, 0.9);
|
| 369 |
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
| 370 |
}
|
|
|
|
| 379 |
flex: 1;
|
| 380 |
background: rgba(255, 255, 255, 0.07);
|
| 381 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 382 |
+
border-radius: 12px;
|
| 383 |
+
padding: 15px 18px;
|
| 384 |
color: white;
|
| 385 |
font-family: 'Segoe UI', system-ui, sans-serif;
|
| 386 |
+
font-size: 0.95em;
|
| 387 |
resize: none;
|
| 388 |
+
min-height: 50px;
|
| 389 |
+
max-height: 100px;
|
| 390 |
transition: all 0.3s ease;
|
| 391 |
}
|
| 392 |
|
|
|
|
| 403 |
|
| 404 |
.input-buttons {
|
| 405 |
display: flex;
|
|
|
|
| 406 |
gap: 8px;
|
| 407 |
}
|
| 408 |
|
| 409 |
.voice-input-btn,
|
| 410 |
.send-btn {
|
| 411 |
+
width: 50px;
|
| 412 |
+
height: 50px;
|
| 413 |
+
border-radius: 12px;
|
| 414 |
background: linear-gradient(135deg, #5a6cff, #7a8aff);
|
| 415 |
border: none;
|
| 416 |
color: white;
|
|
|
|
| 419 |
align-items: center;
|
| 420 |
justify-content: center;
|
| 421 |
transition: all 0.3s ease;
|
| 422 |
+
font-size: 1.1em;
|
| 423 |
}
|
| 424 |
|
| 425 |
.voice-input-btn:hover,
|
|
|
|
| 747 |
/* Responsive Design */
|
| 748 |
@media (max-width: 1200px) {
|
| 749 |
.chat-overlay {
|
| 750 |
+
width: 700px;
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
.chat-overlay.collapsed {
|
| 754 |
+
width: 350px;
|
| 755 |
}
|
| 756 |
}
|
| 757 |
|
|
|
|
| 784 |
|
| 785 |
.chat-overlay {
|
| 786 |
width: 95%;
|
| 787 |
+
max-width: 95vw;
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
.chat-overlay.collapsed {
|
| 791 |
+
width: 300px;
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
.chat-messages {
|
| 795 |
+
height: 140px;
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
.message {
|
| 799 |
+
min-width: 250px;
|
| 800 |
+
max-width: 300px;
|
| 801 |
}
|
| 802 |
}
|
| 803 |
|
| 804 |
/* Scrollbar Styling */
|
| 805 |
::-webkit-scrollbar {
|
| 806 |
width: 8px;
|
| 807 |
+
height: 8px;
|
| 808 |
}
|
| 809 |
|
| 810 |
::-webkit-scrollbar-track {
|
|
|
|
| 997 |
<span id="statusText">Neural AI Tutor Ready</span>
|
| 998 |
</div>
|
| 999 |
|
| 1000 |
+
<!-- Centered Horizontal Chat Interface -->
|
| 1001 |
+
<div class="chat-overlay" id="chatOverlay">
|
| 1002 |
<div class="chat-header">
|
| 1003 |
<div class="chat-title">
|
| 1004 |
<div class="ai-avatar">
|
|
|
|
| 1011 |
</div>
|
| 1012 |
</div>
|
| 1013 |
</div>
|
| 1014 |
+
|
| 1015 |
+
<div class="chat-controls">
|
| 1016 |
+
<button class="collapse-btn" id="collapseBtn" title="Collapse chat">
|
| 1017 |
+
<i class="fas fa-chevron-down"></i>
|
| 1018 |
+
</button>
|
| 1019 |
+
</div>
|
| 1020 |
</div>
|
| 1021 |
|
| 1022 |
<div class="chat-messages" id="chatMessages">
|
|
|
|
| 1024 |
<div class="message-content">
|
| 1025 |
Welcome to the Neural AI Tutor! I'm your interactive learning assistant.
|
| 1026 |
I can help explain complex concepts, answer questions, and guide your learning journey.
|
|
|
|
| 1027 |
</div>
|
| 1028 |
<div class="message-time">Just now</div>
|
| 1029 |
</div>
|
|
|
|
| 1036 |
<div class="message-time">Just now</div>
|
| 1037 |
</div>
|
| 1038 |
|
| 1039 |
+
<div class="message message-ai">
|
| 1040 |
+
<div class="message-content">
|
| 1041 |
+
Try asking me about quantum computing, neural networks, blockchain,
|
| 1042 |
+
calculus, or any other subject you're curious about!
|
| 1043 |
+
</div>
|
| 1044 |
+
<div class="message-time">Just now</div>
|
| 1045 |
+
</div>
|
| 1046 |
+
|
| 1047 |
<!-- Typing indicator (hidden by default) -->
|
| 1048 |
<div class="message-typing" id="typingIndicator" style="display: none;">
|
| 1049 |
<div class="typing-dot"></div>
|
| 1050 |
<div class="typing-dot"></div>
|
| 1051 |
<div class="typing-dot"></div>
|
| 1052 |
+
<span style="color: #a0b0ff; font-size: 0.9em; margin-left: 10px;">Thinking...</span>
|
| 1053 |
</div>
|
| 1054 |
</div>
|
| 1055 |
|
|
|
|
| 1104 |
chevron.classList.toggle('rotated');
|
| 1105 |
}
|
| 1106 |
|
| 1107 |
+
// Chat Collapse Functionality
|
| 1108 |
+
let isChatCollapsed = false;
|
| 1109 |
+
const chatOverlay = document.getElementById('chatOverlay');
|
| 1110 |
+
const collapseBtn = document.getElementById('collapseBtn');
|
| 1111 |
+
|
| 1112 |
+
collapseBtn.addEventListener('click', function(e) {
|
| 1113 |
+
e.stopPropagation();
|
| 1114 |
+
toggleChat();
|
| 1115 |
+
});
|
| 1116 |
+
|
| 1117 |
+
// Click on collapsed chat header to expand
|
| 1118 |
+
chatOverlay.addEventListener('click', function(e) {
|
| 1119 |
+
if (isChatCollapsed && e.target.closest('.chat-header')) {
|
| 1120 |
+
toggleChat();
|
| 1121 |
+
}
|
| 1122 |
+
});
|
| 1123 |
+
|
| 1124 |
+
function toggleChat() {
|
| 1125 |
+
isChatCollapsed = !isChatCollapsed;
|
| 1126 |
+
chatOverlay.classList.toggle('collapsed');
|
| 1127 |
+
|
| 1128 |
+
const icon = collapseBtn.querySelector('i');
|
| 1129 |
+
if (isChatCollapsed) {
|
| 1130 |
+
icon.className = 'fas fa-chevron-up';
|
| 1131 |
+
collapseBtn.title = 'Expand chat';
|
| 1132 |
+
} else {
|
| 1133 |
+
icon.className = 'fas fa-chevron-down';
|
| 1134 |
+
collapseBtn.title = 'Collapse chat';
|
| 1135 |
+
}
|
| 1136 |
+
}
|
| 1137 |
+
|
| 1138 |
// Check if Three.js loaded properly
|
| 1139 |
function checkThreeJS() {
|
| 1140 |
if (typeof THREE === 'undefined') {
|
|
|
|
| 1168 |
document.getElementById('loadingText').textContent = text;
|
| 1169 |
}
|
| 1170 |
|
| 1171 |
+
// Voice Synthesis System (unchanged from previous version)
|
| 1172 |
class VoiceSynthesis {
|
| 1173 |
constructor() {
|
| 1174 |
this.synth = window.speechSynthesis;
|
|
|
|
| 1492 |
}
|
| 1493 |
}
|
| 1494 |
|
| 1495 |
+
// Chat Interface Functionality (updated for horizontal layout)
|
| 1496 |
class ChatInterface {
|
| 1497 |
constructor() {
|
| 1498 |
this.isListening = false;
|
|
|
|
| 1532 |
autoResizeTextarea() {
|
| 1533 |
const textarea = this.chatInput;
|
| 1534 |
textarea.style.height = 'auto';
|
| 1535 |
+
const newHeight = Math.min(textarea.scrollHeight, 100);
|
| 1536 |
textarea.style.height = newHeight + 'px';
|
| 1537 |
}
|
| 1538 |
|
|
|
|
| 1621 |
|
| 1622 |
this.chatMessages.appendChild(messageDiv);
|
| 1623 |
|
| 1624 |
+
// Scroll to right to show latest message
|
| 1625 |
+
this.chatMessages.scrollLeft = this.chatMessages.scrollWidth;
|
| 1626 |
|
| 1627 |
// Update 3D visualization
|
| 1628 |
if (window.visualization) {
|
|
|
|
| 1682 |
|
| 1683 |
showTypingIndicator() {
|
| 1684 |
this.typingIndicator.style.display = 'flex';
|
| 1685 |
+
this.chatMessages.scrollLeft = this.chatMessages.scrollWidth;
|
| 1686 |
}
|
| 1687 |
|
| 1688 |
hideTypingIndicator() {
|
|
|
|
| 1692 |
generateAIResponse(userMessage) {
|
| 1693 |
// Enhanced AI response generator with educational content
|
| 1694 |
const responses = {
|
| 1695 |
+
quantum: "Quantum computing uses quantum bits or 'qubits' that can exist in multiple states simultaneously (superposition). This allows quantum computers to process vast amounts of data in parallel. Unlike classical bits (0 or 1), qubits can be 0, 1, or both at the same time.",
|
| 1696 |
+
neural: "Neural networks learn through backpropagation with gradient descent. They consist of layers of interconnected 'neurons' that process information. During training, the network adjusts connection weights to minimize prediction errors.",
|
| 1697 |
+
ai: "Artificial Intelligence (AI) is the broader concept of machines being able to carry out tasks in a way we would consider 'smart'. Machine Learning (ML) is a subset of AI where machines learn from data without explicit programming.",
|
| 1698 |
+
blockchain: "Blockchain is a distributed, decentralized digital ledger that records transactions across many computers. Each 'block' contains a cryptographic hash of the previous block, creating an immutable chain.",
|
| 1699 |
+
calculus: "Derivatives measure instantaneous rate of change - essentially the slope of a curve at a specific point. If f(x) is your function, the derivative f'(x) tells you how fast f(x) is changing at any x.",
|
| 1700 |
+
default: "I understand you're asking about " + userMessage.substring(0, 40) + "... This is an interesting topic! Let me provide a clear explanation with key concepts and real-world applications."
|
| 1701 |
};
|
| 1702 |
|
| 1703 |
const lowerMessage = userMessage.toLowerCase();
|
|
|
|
| 1712 |
}
|
| 1713 |
}
|
| 1714 |
|
| 1715 |
+
// Main Visualization Class (unchanged from previous version)
|
| 1716 |
class AITutorVisualization {
|
| 1717 |
constructor() {
|
| 1718 |
if (!checkThreeJS()) return;
|