Jemayz commited on
Commit
2d375fe
·
verified ·
1 Parent(s): 6078322

Delete templates/medical_page.html

Browse files
Files changed (1) hide show
  1. templates/medical_page.html +0 -515
templates/medical_page.html DELETED
@@ -1,515 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" class="">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>MultiDom RAG</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- <link
9
- rel="stylesheet"
10
- href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
11
- />
12
- <script>
13
- tailwind.config = {
14
- darkMode: "class",
15
- theme: {
16
- extend: {
17
- colors: {
18
- primary: { dark: "#579be8", light: "#3B82F6" },
19
- secondary: { dark: "#9F1239", light: "#EC4899" },
20
- accent: { dark: "#047857", light: "#10B981" },
21
- dark: { 900: "#0F172A", 800: "#1E293B", 700: "#334155" },
22
- },
23
- fontFamily: { sans: ["Inter", "sans-serif"] },
24
- animation: {
25
- float: "float 6s ease-in-out infinite",
26
- "spin-slow": "spin 10s linear infinite",
27
- },
28
- keyframes: {
29
- float: {
30
- "0%, 100%": { transform: "translateY(0)" },
31
- "50%": { transform: "translateY(-10px)" },
32
- },
33
- },
34
- },
35
- },
36
- };
37
- </script>
38
- <style>
39
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
40
- body {
41
- font-family: "Inter", sans-serif;
42
- scroll-behavior: smooth;
43
- }
44
- details > summary {
45
- list-style: none;
46
- }
47
- details > summary::-webkit-details-marker {
48
- display: none;
49
- }
50
- details > summary::before {
51
- content: "\f078";
52
- font-family: "Font Awesome 6 Free";
53
- font-weight: 900;
54
- margin-right: 0.5rem;
55
- display: inline-block;
56
- transition: transform 0.2s ease-in-out;
57
- }
58
- details[open] > summary::before {
59
- transform: rotate(-180deg);
60
- }
61
- .scroll-progress {
62
- position: fixed;
63
- top: 0;
64
- left: 0;
65
- width: 0%;
66
- height: 4px;
67
- background: linear-gradient(90deg, #3b82f6, #ec4899, #10b981);
68
- z-index: 1000;
69
- transition: width 0.1s;
70
- }
71
- .ripple {
72
- position: relative;
73
- overflow: hidden;
74
- }
75
- .ripple-effect {
76
- position: absolute;
77
- border-radius: 50%;
78
- background-color: rgba(255, 255, 255, 0.4);
79
- transform: scale(0);
80
- animation: ripple 0.6s linear;
81
- pointer-events: none;
82
- }
83
- @keyframes ripple {
84
- to {
85
- transform: scale(4);
86
- opacity: 0;
87
- }
88
- }
89
- </style>
90
- </head>
91
- <body
92
- class="bg-gray-50 dark:bg-dark-900 text-gray-800 dark:text-gray-200"
93
- id="medical_page"
94
- >
95
- <div style="background: yellow; padding: 10px; margin: 10px;">
96
- DEBUG INFO:<br>
97
- Answer exists: {{ 'YES' if answer else 'NO' }}<br>
98
- Answer length: {{ answer|length if answer else 0 }}<br>
99
- History length: {{ history|length if history else 0 }}<br>
100
- Answer preview: {{ answer[:100] if answer else 'NONE' }}
101
- </div>
102
- <div class="scroll-progress"></div>
103
- <nav class="bg-white dark:bg-dark-800 shadow-lg sticky top-0 z-40">
104
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
105
- <div class="flex justify-between h-16 items-center">
106
- <div class="flex items-center">
107
- <i
108
- class="fa-solid fa-file-medical text-primary-light dark:text-primary-dark text-2xl mr-5"
109
- ></i>
110
- <span
111
- class="text-2xl font-bold text-primary-light dark:text-primary-dark"
112
- >MultiDom RAG</span
113
- >
114
- </div>
115
- <div class="hidden sm:flex flex-1 justify-center space-x-8">
116
- <a
117
- href="{{ url_for('homePage') }}"
118
- class="border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-xl hover:animate-pulse"
119
- >Home</a
120
- >
121
- <div class="relative group">
122
- <button
123
- class="border-primary-light dark:border-primary-dark text-gray-900 dark:text-white inline-flex items-center px-1 pt-1 border-b-2 text-xl border-b-2"
124
- >
125
- Demo
126
- <svg
127
- class="w-4 h-4 ml-1"
128
- fill="none"
129
- stroke="currentColor"
130
- viewBox="0 0 24 24"
131
- >
132
- <path
133
- stroke-linecap="round"
134
- stroke-linejoin="round"
135
- stroke-width="2"
136
- d="M19 9l-7 7-7-7"
137
- ></path>
138
- </svg>
139
- </button>
140
- <div
141
- class="absolute left-1/2 transform -translate-x-1/2 mt-2 w-52 rounded-md shadow-lg bg-white dark:bg-dark-700 ring-1 ring-black ring-opacity-5 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50"
142
- >
143
- <div class="py-1">
144
- <a
145
- href="{{ url_for('medical_page') }}"
146
- class="block px-4 py-2 text-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-dark-600 font-semibold"
147
- >Medical (Active)</a
148
- >
149
- <a
150
- href="{{ url_for('islamic_page') }}"
151
- class="block px-4 py-2 text-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-dark-600"
152
- >Islamic</a
153
- >
154
- <a
155
- href="{{ url_for('insurance_page') }}"
156
- class="block px-4 py-2 text-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-dark-600"
157
- >Insurance</a
158
- >
159
- </div>
160
- </div>
161
- </div>
162
- <a
163
- href="{{ url_for('about') }}"
164
- class="border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-xl hover:animate-pulse"
165
- >About</a
166
- >
167
- </div>
168
- <div class="hidden sm:flex items-center space-x-4">
169
- <a
170
- href="{{ url_for('clear_medical_chat') }}"
171
- class="p-2 text-red-500 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-700 rounded-full transition-colors"
172
- title="Clear Chat History"
173
- >
174
- <i class="fas fa-trash-alt"></i>
175
- </a>
176
- <button
177
- id="theme-toggle"
178
- type="button"
179
- class="p-1 rounded-full text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-light dark:focus:ring-primary-dark ripple"
180
- >
181
- <i class="fas fa-moon dark:hidden"></i
182
- ><i class="fas fa-sun hidden dark:block"></i>
183
- </button>
184
- <a
185
- class="ml-4 bg-primary-light dark:bg-primary-dark text-white text-md px-6 py-2 rounded-md font-medium"
186
- >Medical</a
187
- >
188
- </div>
189
- </div>
190
- </div>
191
- </nav>
192
-
193
- <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
194
- <div
195
- id="chat-history"
196
- class="max-w-5xl mx-auto px-4 py-8 pt-12 pb-40 space-y-8"
197
- >
198
- {% if not history %}
199
- <div class="text-center py-10">
200
- <i
201
- class="fa-solid fa-notes-medical text-primary-light dark:text-primary-dark text-6xl mb-4 animate-float"
202
- ></i>
203
- <h2 class="text-3xl font-bold text-gray-800 dark:text-white mb-2">
204
- Medical Assistant (RAG & Swarm)
205
- </h2>
206
- <p class="text-lg text-gray-500 dark:text-gray-400">
207
- Ask a medical question, upload a medical image, or upload a document
208
- for swarm analysis.
209
- </p>
210
- </div>
211
- {% endif %} {% for chat in history %}
212
- {% if chat.type == 'human' %}
213
- <div class="flex justify-end w-full">
214
- <div
215
- class="bg-primary-light text-white p-4 rounded-xl shadow-md max-w-2xl"
216
- >
217
- <p>
218
- {{ chat.content if chat.content is string else
219
- chat.content.content }}
220
- </p>
221
- {% if chat.content and '[Document Uploaded]' in chat.content %}<span
222
- class="text-xs text-blue-200 pt-2 block"
223
- ><i class="fas fa-file-alt mr-1"></i> Document Uploaded</span
224
- >{% endif %}
225
- </div>
226
- </div>
227
-
228
- {% elif chat.type == 'ai' %}
229
- <div class="w-full max-w-2xl space-y-4">
230
- {% set answer_text = chat.content %}
231
- <div>
232
- <div
233
- class="flex items-center text-sm text-gray-800 dark:text-white mb-2 ml-1"
234
- >
235
- <i
236
- class="fa-solid fa-file-medical text-primary-light dark:text-primary-dark mr-2"
237
- ></i>
238
- <strong class="font-semibold">MultiDom RAG</strong>
239
- </div>
240
- <div
241
- class="bg-white dark:bg-dark-700 border dark:border-dark-600 rounded-xl shadow-md p-5"
242
- >
243
- <p
244
- class="text-gray-800 dark:text-white whitespace-pre-wrap text-left"
245
- >
246
- {{ answer_text|safe }}
247
- </p>
248
- </div>
249
- </div>
250
- </div>
251
- {% endif %} {% endfor %} {% if answer %}
252
- <div class="w-full max-w-2xl space-y-4">
253
- <details class="w-full">
254
- <summary
255
- class="flex items-center text-sm text-gray-500 dark:text-gray-400 cursor-pointer mb-2 ml-1"
256
- >
257
- <i
258
- class="fas fa-atom mr-2 animate-spin-slow text-primary-light inline-block"
259
- ></i>
260
- <span>Thinking... view source & thoughts...</span>
261
- </summary>
262
- <div
263
- class="bg-gray-100 dark:bg-dark-800 border dark:border-dark-700 rounded-xl shadow p-4 space-y-4 ml-1 mt-2"
264
- >
265
- {% if source %}
266
- <div>
267
- <h4 class="font-semibold text-gray-700 dark:text-gray-300">
268
- Source:
269
- </h4>
270
- <p class="text-sm text-gray-600 dark:text-gray-400">
271
- {{ source }}
272
- </p>
273
- </div>
274
- {% endif %} {% if thoughts %}
275
- <details>
276
- <summary
277
- class="font-semibold text-medium text-gray-700 dark:text-gray-400 cursor-pointer"
278
- >
279
- View Agent Thoughts (ReAct Process):
280
- </summary>
281
- <p
282
- class="text-sm mt-2 p-2 bg-gray-200 dark:bg-dark-900 rounded whitespace-pre-line"
283
- >
284
- {{ thoughts | safe }}
285
- </p>
286
- </details>
287
- {% endif %} {% if validation %}
288
- <div>
289
- <h4 class="font-semibold text-gray-700 dark:text-gray-300">
290
- Validation:
291
- </h4>
292
- <p class="text-sm text-gray-600 dark:text-gray-400">
293
- {{ validation }}
294
- </p>
295
- </div>
296
- {% endif %}
297
- </div>
298
- </details>
299
-
300
- <div>
301
- <div
302
- class="flex items-center text-sm text-gray-800 dark:text-white mb-2 ml-1"
303
- >
304
- <i
305
- class="fa-solid fa-file-medical text-primary-light dark:text-primary-dark mr-2"
306
- ></i>
307
- <strong class="font-semibold">MultiDom RAG</strong>
308
- </div>
309
- <div
310
- class="bg-white dark:bg-dark-700 border dark:border-dark-600 rounded-xl shadow-md p-5"
311
- >
312
- <p
313
- class="text-gray-800 dark:text-white text-left whitespace-pre-line"
314
- >
315
- {{ answer|safe }}
316
- </p>
317
- </div>
318
- </div>
319
- </div>
320
- {% endif %}
321
- </div>
322
- </main>
323
-
324
- <footer
325
- class="fixed bottom-0 left-0 w-full z-20 bg-white/80 dark:bg-dark-900/80 backdrop-blur-sm border-t dark:border-dark-700"
326
- >
327
- <form
328
- method="POST"
329
- action="{{ url_for('medical_page') }}"
330
- enctype="multipart/form-data"
331
- class="relative max-w-5xl mx-auto flex items-center space-x-3 p-4"
332
- >
333
- <div
334
- id="upload-menu"
335
- class="absolute bottom-20 left-0 w-52 bg-white dark:bg-dark-700 border dark:border-dark-600 rounded-lg shadow-lg py-2 z-10 hidden"
336
- >
337
- <button
338
- type="button"
339
- id="upload-image-btn"
340
- class="w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-dark-600 flex items-center"
341
- >
342
- <i class="fas fa-image mr-3"></i> Upload Image
343
- </button>
344
- <button
345
- type="button"
346
- id="upload-doc-btn"
347
- class="w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-dark-600 flex items-center"
348
- >
349
- <i class="fas fa-file-alt mr-3"></i> Upload Document
350
- </button>
351
- </div>
352
- <button
353
- type="button"
354
- id="upload-toggle"
355
- class="p-2 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-dark-700 rounded-full transition-colors"
356
- >
357
- <i class="fas fa-plus text-xl"></i>
358
- </button>
359
- <input type="file" id="file-upload" name="image" class="hidden" />
360
- <!-- Renamed to image/document to match Python-->
361
- <input type="file" id="doc-upload" name="document" class="hidden" />
362
- <!-- Added hidden doc input -->
363
- <input
364
- type="text"
365
- id="query"
366
- name="query"
367
- required
368
- class="flex-1 px-4 py-3 rounded-lg bg-gray-100 dark:bg-dark-700 border border-gray-300 dark:border-dark-600 focus:outline-none focus:ring-2 focus:ring-primary-light"
369
- placeholder="Ask a medical question or include an upload..."
370
- />
371
- <span
372
- id="file-name-display"
373
- class="text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs"
374
- title=""
375
- ></span>
376
- <button
377
- type="submit"
378
- class="p-3 bg-primary-light hover:bg-primary-dark text-white rounded-full transition-colors shadow-lg hover:scale-105 transform ripple"
379
- >
380
- <i class="fas fa-paper-plane"></i>
381
- </button>
382
- </form>
383
- </footer>
384
-
385
- <script>
386
- const themeToggle = document.getElementById("theme-toggle"),
387
- html = document.documentElement;
388
- themeToggle.addEventListener("click", () => {
389
- html.classList.toggle("dark");
390
- localStorage.setItem(
391
- "theme",
392
- html.classList.contains("dark") ? "dark" : "light"
393
- );
394
- });
395
- if (
396
- localStorage.getItem("theme") === "dark" ||
397
- (!localStorage.getItem("theme") &&
398
- window.matchMedia("(prefers-color-scheme: dark)").matches)
399
- ) {
400
- html.classList.add("dark");
401
- }
402
-
403
- document.addEventListener("DOMContentLoaded", () => {
404
- window.addEventListener("scroll", () => {
405
- const scrollTop =
406
- document.documentElement.scrollTop || document.body.scrollTop;
407
- const scrollHeight =
408
- document.documentElement.scrollHeight -
409
- document.documentElement.clientHeight;
410
- const scrollProgress =
411
- scrollHeight > 0 ? (scrollTop / scrollHeight) * 100 : 0;
412
- const progressBar = document.querySelector(".scroll-progress");
413
- if (progressBar) progressBar.style.width = scrollProgress + "%";
414
- });
415
- document.querySelectorAll(".ripple").forEach((button) => {
416
- button.addEventListener("click", function (e) {
417
- const rect = this.getBoundingClientRect(),
418
- x = e.clientX - rect.left,
419
- y = e.clientY - rect.top;
420
- const ripple = document.createElement("span");
421
- ripple.className = "ripple-effect";
422
- ripple.style.left = x + "px";
423
- ripple.style.top = y + "px";
424
- this.appendChild(ripple);
425
- setTimeout(() => {
426
- ripple.remove();
427
- }, 600);
428
- });
429
- });
430
-
431
- // --- START OF UPLOAD LOGIC ---
432
- const uploadToggle = document.getElementById("upload-toggle"),
433
- uploadMenu = document.getElementById("upload-menu"),
434
- uploadImageBtn = document.getElementById("upload-image-btn"),
435
- uploadDocBtn = document.getElementById("upload-doc-btn"),
436
- fileUploadInput = document.getElementById("file-upload"), // For images
437
- docUploadInput = document.getElementById("doc-upload"), // For documents
438
- fileNameDisplay = document.getElementById("file-name-display");
439
-
440
- // Helper to clear both inputs
441
- const clearFileInputs = () => {
442
- fileUploadInput.value = null;
443
- docUploadInput.value = null;
444
- fileNameDisplay.textContent = "";
445
- fileNameDisplay.title = "";
446
- };
447
-
448
- if (uploadToggle)
449
- uploadToggle.addEventListener("click", (e) => {
450
- e.stopPropagation();
451
- uploadMenu.classList.toggle("hidden");
452
- });
453
-
454
- if (uploadImageBtn)
455
- uploadImageBtn.addEventListener("click", () => {
456
- clearFileInputs();
457
- fileUploadInput.accept = "image/*";
458
- fileUploadInput.click();
459
- uploadMenu.classList.add("hidden");
460
- });
461
-
462
- if (uploadDocBtn)
463
- uploadDocBtn.addEventListener("click", () => {
464
- clearFileInputs();
465
- docUploadInput.accept = ".pdf,.doc,.docx,.txt";
466
- docUploadInput.click();
467
- uploadMenu.classList.add("hidden");
468
- });
469
-
470
- // Event listener for image input
471
- if (fileUploadInput)
472
- fileUploadInput.addEventListener("change", () => {
473
- const file = fileUploadInput.files[0];
474
- if (file) {
475
- fileNameDisplay.textContent = file.name;
476
- fileNameDisplay.title = file.name;
477
- docUploadInput.value = null; // Ensure the other input is cleared
478
- }
479
- });
480
-
481
- // Event listener for document input
482
- if (docUploadInput)
483
- docUploadInput.addEventListener("change", () => {
484
- const file = docUploadInput.files[0];
485
- if (file) {
486
- fileNameDisplay.textContent = file.name;
487
- fileNameDisplay.title = file.name;
488
- fileUploadInput.value = null; // Ensure the other input is cleared
489
- }
490
- });
491
-
492
- document.addEventListener("click", (e) => {
493
- if (
494
- uploadMenu &&
495
- !uploadMenu.classList.contains("hidden") &&
496
- !uploadToggle.contains(e.target)
497
- ) {
498
- uploadMenu.classList.add("hidden");
499
- }
500
- });
501
-
502
- // Scroll to bottom on load
503
- setTimeout(() => {
504
- const chatHistoryDiv = document.getElementById("chat-history");
505
- if (chatHistoryDiv) {
506
- window.scrollTo({
507
- top: chatHistoryDiv.scrollHeight,
508
- behavior: "smooth",
509
- });
510
- }
511
- }, 100);
512
- });
513
- </script>
514
- </body>
515
- </html>