BinKhoaLe1812 commited on
Commit
a8d8f0f
·
verified ·
1 Parent(s): b344aa7

Upd page default redirection

Browse files
Files changed (1) hide show
  1. api/routes.py +331 -3
api/routes.py CHANGED
@@ -7,7 +7,7 @@ import logging
7
  import uuid
8
  from datetime import datetime, timedelta
9
  from fastapi import APIRouter, Request
10
- from fastapi.responses import JSONResponse
11
  from .chatbot import RAGMedicalChatbot
12
  from .retrieval import retrieval_engine
13
  from .database import db_manager
@@ -215,5 +215,333 @@ async def health_check():
215
 
216
  @router.get("/")
217
  async def root():
218
- """Root endpoint"""
219
- return {"message": "Medical Chatbot API", "version": "3.0.0"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  import uuid
8
  from datetime import datetime, timedelta
9
  from fastapi import APIRouter, Request
10
+ from fastapi.responses import JSONResponse, HTMLResponse
11
  from .chatbot import RAGMedicalChatbot
12
  from .retrieval import retrieval_engine
13
  from .database import db_manager
 
215
 
216
  @router.get("/")
217
  async def root():
218
+ """Root endpoint - Landing page with redirect to main app"""
219
+
220
+ html_content = """
221
+ <!DOCTYPE html>
222
+ <html lang="en">
223
+ <head>
224
+ <meta charset="UTF-8">
225
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
226
+ <title>Medical Chatbot API</title>
227
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
228
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
229
+ <style>
230
+ * {
231
+ margin: 0;
232
+ padding: 0;
233
+ box-sizing: border-box;
234
+ }
235
+
236
+ body {
237
+ font-family: 'Inter', sans-serif;
238
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
239
+ min-height: 100vh;
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ overflow: hidden;
244
+ position: relative;
245
+ }
246
+
247
+ /* Animated background particles */
248
+ .particles {
249
+ position: absolute;
250
+ top: 0;
251
+ left: 0;
252
+ width: 100%;
253
+ height: 100%;
254
+ overflow: hidden;
255
+ z-index: 1;
256
+ }
257
+
258
+ .particle {
259
+ position: absolute;
260
+ background: rgba(255, 255, 255, 0.1);
261
+ border-radius: 50%;
262
+ animation: float 6s ease-in-out infinite;
263
+ }
264
+
265
+ .particle:nth-child(1) { width: 80px; height: 80px; top: 20%; left: 10%; animation-delay: 0s; }
266
+ .particle:nth-child(2) { width: 120px; height: 120px; top: 60%; left: 80%; animation-delay: 2s; }
267
+ .particle:nth-child(3) { width: 60px; height: 60px; top: 80%; left: 20%; animation-delay: 4s; }
268
+ .particle:nth-child(4) { width: 100px; height: 100px; top: 10%; left: 70%; animation-delay: 1s; }
269
+ .particle:nth-child(5) { width: 90px; height: 90px; top: 40%; left: 50%; animation-delay: 3s; }
270
+
271
+ @keyframes float {
272
+ 0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
273
+ 50% { transform: translateY(-20px) rotate(180deg); opacity: 1; }
274
+ }
275
+
276
+ .container {
277
+ background: rgba(255, 255, 255, 0.1);
278
+ backdrop-filter: blur(20px);
279
+ border: 1px solid rgba(255, 255, 255, 0.2);
280
+ border-radius: 24px;
281
+ padding: 3rem 2rem;
282
+ text-align: center;
283
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
284
+ max-width: 500px;
285
+ width: 90%;
286
+ position: relative;
287
+ z-index: 2;
288
+ animation: slideUp 0.8s ease-out;
289
+ }
290
+
291
+ @keyframes slideUp {
292
+ from {
293
+ opacity: 0;
294
+ transform: translateY(50px);
295
+ }
296
+ to {
297
+ opacity: 1;
298
+ transform: translateY(0);
299
+ }
300
+ }
301
+
302
+ .logo {
303
+ width: 80px;
304
+ height: 80px;
305
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
306
+ border-radius: 20px;
307
+ display: flex;
308
+ align-items: center;
309
+ justify-content: center;
310
+ margin: 0 auto 1.5rem;
311
+ animation: pulse 2s ease-in-out infinite;
312
+ }
313
+
314
+ @keyframes pulse {
315
+ 0%, 100% { transform: scale(1); }
316
+ 50% { transform: scale(1.05); }
317
+ }
318
+
319
+ .logo i {
320
+ font-size: 2rem;
321
+ color: white;
322
+ }
323
+
324
+ h1 {
325
+ color: white;
326
+ font-size: 2.5rem;
327
+ font-weight: 700;
328
+ margin-bottom: 0.5rem;
329
+ background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
330
+ -webkit-background-clip: text;
331
+ -webkit-text-fill-color: transparent;
332
+ background-clip: text;
333
+ }
334
+
335
+ .subtitle {
336
+ color: rgba(255, 255, 255, 0.8);
337
+ font-size: 1.1rem;
338
+ margin-bottom: 2rem;
339
+ font-weight: 400;
340
+ }
341
+
342
+ .version {
343
+ color: rgba(255, 255, 255, 0.6);
344
+ font-size: 0.9rem;
345
+ margin-bottom: 2rem;
346
+ font-weight: 300;
347
+ }
348
+
349
+ .redirect-btn {
350
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
351
+ color: white;
352
+ border: none;
353
+ padding: 1rem 2rem;
354
+ border-radius: 12px;
355
+ font-size: 1.1rem;
356
+ font-weight: 600;
357
+ cursor: pointer;
358
+ transition: all 0.3s ease;
359
+ text-decoration: none;
360
+ display: inline-flex;
361
+ align-items: center;
362
+ gap: 0.5rem;
363
+ box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
364
+ position: relative;
365
+ overflow: hidden;
366
+ }
367
+
368
+ .redirect-btn::before {
369
+ content: '';
370
+ position: absolute;
371
+ top: 0;
372
+ left: -100%;
373
+ width: 100%;
374
+ height: 100%;
375
+ background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
376
+ transition: left 0.5s;
377
+ }
378
+
379
+ .redirect-btn:hover::before {
380
+ left: 100%;
381
+ }
382
+
383
+ .redirect-btn:hover {
384
+ transform: translateY(-2px);
385
+ box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
386
+ }
387
+
388
+ .redirect-btn:active {
389
+ transform: translateY(0);
390
+ }
391
+
392
+ .redirect-btn i {
393
+ font-size: 1.2rem;
394
+ transition: transform 0.3s ease;
395
+ }
396
+
397
+ .redirect-btn:hover i {
398
+ transform: translateX(3px);
399
+ }
400
+
401
+ .features {
402
+ margin-top: 2rem;
403
+ display: grid;
404
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
405
+ gap: 1rem;
406
+ }
407
+
408
+ .feature {
409
+ color: rgba(255, 255, 255, 0.7);
410
+ font-size: 0.9rem;
411
+ font-weight: 500;
412
+ }
413
+
414
+ .feature i {
415
+ display: block;
416
+ font-size: 1.5rem;
417
+ margin-bottom: 0.5rem;
418
+ color: rgba(255, 255, 255, 0.9);
419
+ }
420
+
421
+ @media (max-width: 768px) {
422
+ .container {
423
+ padding: 2rem 1.5rem;
424
+ margin: 1rem;
425
+ }
426
+
427
+ h1 {
428
+ font-size: 2rem;
429
+ }
430
+
431
+ .subtitle {
432
+ font-size: 1rem;
433
+ }
434
+
435
+ .redirect-btn {
436
+ padding: 0.8rem 1.5rem;
437
+ font-size: 1rem;
438
+ }
439
+ }
440
+ </style>
441
+ </head>
442
+ <body>
443
+ <div class="particles">
444
+ <div class="particle"></div>
445
+ <div class="particle"></div>
446
+ <div class="particle"></div>
447
+ <div class="particle"></div>
448
+ <div class="particle"></div>
449
+ </div>
450
+
451
+ <div class="container">
452
+ <div class="logo">
453
+ <i class="fas fa-stethoscope"></i>
454
+ </div>
455
+
456
+ <h1>Medical Chatbot</h1>
457
+ <p class="subtitle">AI-Powered Health Assistant</p>
458
+ <p class="version">API Version 3.0.0</p>
459
+
460
+ <a href="https://medical-chatbot-henna.vercel.app/" class="redirect-btn" target="_blank">
461
+ <i class="fas fa-external-link-alt"></i>
462
+ Launch Application
463
+ </a>
464
+
465
+ <div class="features">
466
+ <div class="feature">
467
+ <i class="fas fa-brain"></i>
468
+ AI-Powered
469
+ </div>
470
+ <div class="feature">
471
+ <i class="fas fa-shield-alt"></i>
472
+ Secure
473
+ </div>
474
+ <div class="feature">
475
+ <i class="fas fa-globe"></i>
476
+ Multi-Language
477
+ </div>
478
+ </div>
479
+ </div>
480
+
481
+ <script>
482
+ // Add some interactive effects
483
+ document.addEventListener('DOMContentLoaded', function() {
484
+ const btn = document.querySelector('.redirect-btn');
485
+ const particles = document.querySelectorAll('.particle');
486
+
487
+ // Add click animation
488
+ btn.addEventListener('click', function(e) {
489
+ // Create ripple effect
490
+ const ripple = document.createElement('span');
491
+ const rect = this.getBoundingClientRect();
492
+ const size = Math.max(rect.width, rect.height);
493
+ const x = e.clientX - rect.left - size / 2;
494
+ const y = e.clientY - rect.top - size / 2;
495
+
496
+ ripple.style.cssText = `
497
+ position: absolute;
498
+ width: ${size}px;
499
+ height: ${size}px;
500
+ left: ${x}px;
501
+ top: ${y}px;
502
+ background: rgba(255, 255, 255, 0.3);
503
+ border-radius: 50%;
504
+ transform: scale(0);
505
+ animation: ripple 0.6s ease-out;
506
+ pointer-events: none;
507
+ `;
508
+
509
+ this.appendChild(ripple);
510
+
511
+ setTimeout(() => {
512
+ ripple.remove();
513
+ }, 600);
514
+ });
515
+
516
+ // Add CSS for ripple animation
517
+ const style = document.createElement('style');
518
+ style.textContent = `
519
+ @keyframes ripple {
520
+ to {
521
+ transform: scale(2);
522
+ opacity: 0;
523
+ }
524
+ }
525
+ `;
526
+ document.head.appendChild(style);
527
+
528
+ // Animate particles on mouse move
529
+ document.addEventListener('mousemove', function(e) {
530
+ const x = e.clientX / window.innerWidth;
531
+ const y = e.clientY / window.innerHeight;
532
+
533
+ particles.forEach((particle, index) => {
534
+ const speed = (index + 1) * 0.5;
535
+ const xOffset = (x - 0.5) * speed * 20;
536
+ const yOffset = (y - 0.5) * speed * 20;
537
+
538
+ particle.style.transform = `translate(${xOffset}px, ${yOffset}px)`;
539
+ });
540
+ });
541
+ });
542
+ </script>
543
+ </body>
544
+ </html>
545
+ """
546
+
547
+ return HTMLResponse(content=html_content)