droplyvictor89 commited on
Commit
03f2165
·
verified ·
1 Parent(s): e9ac5f2

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +477 -0
templates/index.html ADDED
@@ -0,0 +1,477 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ro">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>BeatAI | Advanced Cardiac Intelligence</title>
7
+
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet">
9
+ <link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
10
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
11
+
12
+ <style>
13
+ /* --- CONFIGURARE CULORI & VARIABILE --- */
14
+ :root {
15
+ --bg-deep: #050505;
16
+ --bg-glass: rgba(20, 20, 20, 0.6);
17
+ --text-primary: #ffffff;
18
+ --text-secondary: rgba(255, 255, 255, 0.6);
19
+ --accent-red: #ff003c; /* Cyberpunk Red */
20
+ --accent-glow: rgba(255, 0, 60, 0.5);
21
+ --border-glass: rgba(255, 255, 255, 0.08);
22
+ --border-active: rgba(255, 0, 60, 0.4);
23
+ --blur-strength: 16px; /* Liquid Glass effect */
24
+ --liquid-surface: rgba(255, 255, 255, 0.03);
25
+ }
26
+
27
+ .light-mode {
28
+ --bg-deep: #f0f2f5;
29
+ --bg-glass: rgba(255, 255, 255, 0.7);
30
+ --text-primary: #1a1a1a;
31
+ --text-secondary: rgba(0, 0, 0, 0.6);
32
+ --accent-red: #d9002a;
33
+ --accent-glow: rgba(217, 0, 42, 0.3);
34
+ --border-glass: rgba(0, 0, 0, 0.08);
35
+ --border-active: rgba(217, 0, 42, 0.4);
36
+ --liquid-surface: rgba(0, 0, 0, 0.02);
37
+ }
38
+
39
+ /* --- GLOBAL & RESET --- */
40
+ * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
41
+
42
+ body, html {
43
+ margin: 0; padding: 0; height: 100%; width: 100%;
44
+ font-family: 'Inter', sans-serif;
45
+ background-color: var(--bg-deep);
46
+ color: var(--text-primary);
47
+ overflow: hidden; /* Previne scroll pe body, doar in chat */
48
+ transition: background 0.4s ease;
49
+ }
50
+
51
+ /* Background Pulse Effect (Heartbeat ambiental) */
52
+ body::after {
53
+ content: ''; position: fixed; top: 50%; left: 50%;
54
+ width: 80vw; height: 80vw;
55
+ background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
56
+ transform: translate(-50%, -50%);
57
+ opacity: 0.15; z-index: -1;
58
+ animation: breathe 4s ease-in-out infinite;
59
+ pointer-events: none;
60
+ }
61
+
62
+ @keyframes breathe {
63
+ 0%, 100% { opacity: 0.1; transform: translate(-50%, -50%) scale(1); }
64
+ 50% { opacity: 0.2; transform: translate(-50%, -50%) scale(1.1); }
65
+ }
66
+
67
+ /* --- UI COMPONENTS: LIQUID GLASS --- */
68
+ .glass-panel {
69
+ background: var(--bg-glass);
70
+ backdrop-filter: blur(var(--blur-strength));
71
+ -webkit-backdrop-filter: blur(var(--blur-strength));
72
+ border: 1px solid var(--border-glass);
73
+ box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
74
+ }
75
+
76
+ /* --- HEADER --- */
77
+ header {
78
+ position: fixed; top: 0; left: 0; width: 100%; height: 70px;
79
+ display: flex; justify-content: space-between; align-items: center;
80
+ padding: 0 20px; z-index: 1000;
81
+ border-bottom: 1px solid var(--border-glass);
82
+ }
83
+
84
+ .brand-container { text-align: center; }
85
+ .brand-name {
86
+ font-family: 'Orbitron', sans-serif;
87
+ font-weight: 900; font-size: 1.4rem; letter-spacing: 2px;
88
+ color: var(--text-primary);
89
+ text-shadow: 0 0 10px var(--accent-glow);
90
+ }
91
+ .brand-sub { font-size: 0.6rem; color: var(--accent-red); font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }
92
+
93
+ /* --- SIDE MENU (DRAWER) --- */
94
+ #side-menu {
95
+ position: fixed; top: 0; left: 0; height: 100%; width: 280px;
96
+ transform: translateX(-100%);
97
+ transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
98
+ z-index: 2000; padding: 80px 20px 20px 20px;
99
+ display: flex; flex-direction: column;
100
+ border-right: 1px solid var(--border-glass);
101
+ }
102
+ #side-menu.open { transform: translateX(0); }
103
+
104
+ .menu-overlay {
105
+ position: fixed; inset: 0; background: rgba(0,0,0,0.8);
106
+ backdrop-filter: blur(4px); opacity: 0; pointer-events: none;
107
+ transition: 0.3s; z-index: 1500;
108
+ }
109
+ .menu-overlay.active { opacity: 1; pointer-events: all; }
110
+
111
+ .history-item {
112
+ padding: 15px; margin-bottom: 10px; border-radius: 12px;
113
+ background: var(--liquid-surface); border: 1px solid var(--border-glass);
114
+ color: var(--text-secondary); font-size: 0.9rem;
115
+ cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 10px;
116
+ }
117
+ .history-item:hover, .history-item.active {
118
+ background: rgba(255, 0, 60, 0.1);
119
+ border-color: var(--accent-red);
120
+ color: var(--text-primary);
121
+ }
122
+
123
+ /* --- CHAT AREA --- */
124
+ #chat-container {
125
+ height: 100vh; overflow-y: auto;
126
+ padding: 90px 15px 120px 15px; /* Spatiu pentru header si input */
127
+ scroll-behavior: smooth;
128
+ }
129
+
130
+ /* Message Bubbles */
131
+ .message {
132
+ max-width: 85%; margin-bottom: 25px; padding: 18px 22px;
133
+ border-radius: 20px; line-height: 1.6; font-size: 0.95rem;
134
+ position: relative; animation: slideUp 0.4s ease-out;
135
+ }
136
+ @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
137
+
138
+ .msg-ai {
139
+ background: var(--liquid-surface);
140
+ border: 1px solid var(--border-glass);
141
+ border-top-left-radius: 4px;
142
+ backdrop-filter: blur(5px);
143
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
144
+ }
145
+ .msg-ai strong { color: var(--accent-red); }
146
+
147
+ .msg-user {
148
+ background: linear-gradient(135deg, var(--accent-red), #990024);
149
+ color: white; align-self: flex-end; margin-left: auto;
150
+ border-bottom-right-radius: 4px;
151
+ box-shadow: 0 4px 20px var(--accent-glow);
152
+ }
153
+
154
+ /* --- INPUT AREA (Fixed Bottom) --- */
155
+ .input-area {
156
+ position: fixed; bottom: 0; left: 0; width: 100%;
157
+ padding: 15px 20px 30px 20px; /* Extra padding jos pentru iPhone */
158
+ background: linear-gradient(to top, var(--bg-deep) 80%, transparent);
159
+ z-index: 900; display: flex; justify-content: center;
160
+ }
161
+
162
+ .input-wrapper {
163
+ width: 100%; max-width: 800px;
164
+ background: var(--bg-glass);
165
+ border: 1px solid var(--border-glass);
166
+ border-radius: 50px;
167
+ padding: 8px 8px 8px 20px;
168
+ display: flex; align-items: center; gap: 10px;
169
+ backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
170
+ transition: 0.3s;
171
+ box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
172
+ }
173
+ .input-wrapper:focus-within {
174
+ border-color: var(--accent-red);
175
+ box-shadow: 0 0 20px var(--accent-glow);
176
+ }
177
+
178
+ input {
179
+ flex: 1; background: transparent; border: none;
180
+ color: var(--text-primary); font-size: 1rem; outline: none;
181
+ }
182
+
183
+ /* BUTTONS WITH HEARTBEAT */
184
+ .btn-send {
185
+ width: 45px; height: 45px; border-radius: 50%;
186
+ background: var(--accent-red); border: none; color: white;
187
+ display: flex; align-items: center; justify-content: center;
188
+ font-size: 1.2rem; cursor: pointer; transition: 0.3s;
189
+ }
190
+ .btn-send:hover { transform: scale(1.1); box-shadow: 0 0 15px var(--accent-red); }
191
+ .btn-send:active { transform: scale(0.95); }
192
+
193
+ .btn-icon {
194
+ background: transparent; border: 1px solid var(--border-glass);
195
+ color: var(--text-primary); padding: 8px; border-radius: 12px;
196
+ cursor: pointer; transition: 0.3s;
197
+ }
198
+ .btn-icon:hover { background: rgba(255,255,255,0.1); }
199
+
200
+ /* --- ANIMATII SPECIALE (BeatAI Core) --- */
201
+
202
+ /* 1. EKG Line Animation (Thinking) */
203
+ .thinking-container {
204
+ display: flex; align-items: center; gap: 15px;
205
+ padding: 15px 25px; border-radius: 50px;
206
+ background: var(--liquid-surface); border: 1px solid var(--border-active);
207
+ width: fit-content; margin-bottom: 20px;
208
+ }
209
+
210
+ .ekg-loader {
211
+ width: 30px; height: 20px;
212
+ position: relative;
213
+ }
214
+ .ekg-loader::before {
215
+ content: ''; position: absolute; left: 0; bottom: 0;
216
+ width: 100%; height: 2px; background: var(--text-secondary);
217
+ }
218
+ .ekg-line {
219
+ width: 100%; height: 100%;
220
+ fill: none; stroke: var(--accent-red); stroke-width: 3;
221
+ stroke-dasharray: 100; stroke-dashoffset: 100;
222
+ animation: dash 1.5s linear infinite;
223
+ }
224
+ @keyframes dash { to { stroke-dashoffset: 0; } }
225
+
226
+ /* 2. Welcome Screen Heartbeat */
227
+ .welcome-screen {
228
+ height: 100%; display: flex; flex-direction: column;
229
+ align-items: center; justify-content: center; text-align: center;
230
+ opacity: 0.8;
231
+ }
232
+ .logo-pulse {
233
+ font-size: 4rem; margin-bottom: 20px; color: var(--accent-red);
234
+ animation: heartBeat 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
235
+ text-shadow: 0 0 30px var(--accent-red);
236
+ }
237
+ @keyframes heartBeat {
238
+ 0% { transform: scale(1); }
239
+ 14% { transform: scale(1.3); }
240
+ 28% { transform: scale(1); }
241
+ 42% { transform: scale(1.3); }
242
+ 70% { transform: scale(1); }
243
+ }
244
+
245
+ /* --- PREVIEW FILE --- */
246
+ .file-preview-bar {
247
+ position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
248
+ display: flex; gap: 10px; background: var(--bg-glass);
249
+ padding: 10px; border-radius: 15px; border: 1px solid var(--border-glass);
250
+ backdrop-filter: blur(10px); display: none;
251
+ }
252
+ .file-thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; border: 1px solid var(--accent-red); }
253
+
254
+ </style>
255
+ </head>
256
+ <body onload="app.init()">
257
+
258
+ <div class="menu-overlay" onclick="app.toggleMenu()"></div>
259
+
260
+ <nav id="side-menu" class="glass-panel">
261
+ <div style="margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center;">
262
+ <span style="font-family: 'Orbitron'; color: var(--accent-red); font-weight: bold;">HISTORY</span>
263
+ <button onclick="app.startNewChat()" class="btn-icon" style="border-color: var(--accent-red); color: var(--accent-red);"><i class="ri-add-line"></i></button>
264
+ </div>
265
+ <div id="history-list" style="overflow-y: auto; flex: 1;">
266
+ </div>
267
+ <div style="margin-top: 20px; font-size: 0.7rem; opacity: 0.4; text-align: center; letter-spacing: 2px;">
268
+ BEATAI v2.0 BY DAEMON
269
+ </div>
270
+ </nav>
271
+
272
+ <header class="glass-panel">
273
+ <button class="btn-icon" onclick="app.toggleMenu()"><i class="ri-menu-4-fill"></i></button>
274
+ <div class="brand-container">
275
+ <div class="brand-name">BEAT<span style="color: var(--accent-red);">AI</span></div>
276
+ <div class="brand-sub">CARDIAC INTELLIGENCE</div>
277
+ </div>
278
+ <button class="btn-icon" onclick="app.toggleTheme()"><i class="ri-drop-line"></i></button>
279
+ </header>
280
+
281
+ <main id="chat-container">
282
+ <div id="welcome-screen" class="welcome-screen">
283
+ <i class="ri-pulse-line logo-pulse"></i>
284
+ <h1 style="font-family: 'Orbitron'; margin: 0;">BEAT AI</h1>
285
+ <p style="opacity: 0.6; margin-top: 10px;">Monitoring System Active.<br>Upload EKG or describe symptoms.</p>
286
+ </div>
287
+ </main>
288
+
289
+ <div class="input-area">
290
+ <div class="file-preview-bar" id="file-preview"></div>
291
+ <div class="input-wrapper">
292
+ <button class="btn-icon" onclick="document.getElementById('file-upload').click()" style="border: none; padding: 0;">
293
+ <i class="ri-attachment-2" style="font-size: 1.2rem; opacity: 0.7;"></i>
294
+ </button>
295
+ <input type="file" id="file-upload" hidden multiple accept="image/*" onchange="app.handleFiles(event)">
296
+
297
+ <input type="text" id="user-input" placeholder="Type a message..." autocomplete="off">
298
+
299
+ <button class="btn-send" onclick="app.sendMessage()">
300
+ <i class="ri-arrow-up-line"></i>
301
+ </button>
302
+ </div>
303
+ </div>
304
+
305
+ <script>
306
+ const app = {
307
+ state: {
308
+ sessions: JSON.parse(localStorage.getItem('beatai_pro_storage')) || [],
309
+ currentSessionId: null,
310
+ isTyping: false,
311
+ selectedFiles: []
312
+ },
313
+
314
+ init: function() {
315
+ // Force new session on reload
316
+ this.startNewChat();
317
+ this.renderHistory();
318
+
319
+ // Enter key listener
320
+ document.getElementById('user-input').addEventListener('keypress', (e) => {
321
+ if (e.key === 'Enter') this.sendMessage();
322
+ });
323
+ },
324
+
325
+ toggleMenu: function() {
326
+ document.getElementById('side-menu').classList.toggle('open');
327
+ document.querySelector('.menu-overlay').classList.toggle('active');
328
+ },
329
+
330
+ toggleTheme: function() {
331
+ document.body.classList.toggle('light-mode');
332
+ },
333
+
334
+ startNewChat: function() {
335
+ this.state.currentSessionId = Date.now();
336
+ document.getElementById('chat-container').innerHTML = `
337
+ <div id="welcome-screen" class="welcome-screen">
338
+ <i class="ri-heart-pulse-fill logo-pulse"></i>
339
+ <h1 style="font-family: 'Orbitron'; margin: 0;">BEAT AI</h1>
340
+ <p style="opacity: 0.6; margin-top: 10px;">System Online.<br>Hello, Daemon.</p>
341
+ </div>`;
342
+ if(document.getElementById('side-menu').classList.contains('open')) this.toggleMenu();
343
+ this.state.selectedFiles = [];
344
+ document.getElementById('file-preview').style.display = 'none';
345
+ },
346
+
347
+ handleFiles: function(event) {
348
+ const files = Array.from(event.target.files);
349
+ const previewContainer = document.getElementById('file-preview');
350
+ previewContainer.innerHTML = '';
351
+
352
+ if(files.length > 0) {
353
+ previewContainer.style.display = 'flex';
354
+ files.forEach(file => {
355
+ const reader = new FileReader();
356
+ reader.onload = (e) => {
357
+ this.state.selectedFiles.push(e.target.result); // Base64
358
+ previewContainer.innerHTML += `<img src="${e.target.result}" class="file-thumb">`;
359
+ };
360
+ reader.readAsDataURL(file);
361
+ });
362
+ }
363
+ },
364
+
365
+ sendMessage: async function() {
366
+ if (this.state.isTyping) return;
367
+ const input = document.getElementById('user-input');
368
+ const text = input.value.trim();
369
+ const hasFiles = this.state.selectedFiles.length > 0;
370
+
371
+ if (!text && !hasFiles) return;
372
+
373
+ // Remove welcome screen
374
+ const welcome = document.getElementById('welcome-screen');
375
+ if (welcome) welcome.remove();
376
+
377
+ // 1. User Message
378
+ let userContent = text;
379
+ if (hasFiles) {
380
+ userContent += `<br><div style="display:flex; gap:5px; margin-top:5px;">
381
+ ${this.state.selectedFiles.map(src => `<img src="${src}" style="height:60px; border-radius:8px;">`).join('')}
382
+ </div>`;
383
+ }
384
+ this.appendMessage('user', userContent);
385
+
386
+ input.value = '';
387
+ const filesToSend = [...this.state.selectedFiles];
388
+ this.state.selectedFiles = []; // Reset files
389
+ document.getElementById('file-preview').style.display = 'none';
390
+
391
+ // 2. Thinking Animation (EKG)
392
+ this.state.isTyping = true;
393
+ const chatBox = document.getElementById('chat-container');
394
+
395
+ const thinkingDiv = document.createElement('div');
396
+ thinkingDiv.className = 'thinking-container';
397
+ const lang = /([ăîâșț])/gi.test(text) ? 'ro' : 'en';
398
+ const thinkText = lang === 'ro' ? 'Beat analizează...' : 'Beat is analyzing...';
399
+
400
+ // SVG EKG Animation
401
+ thinkingDiv.innerHTML = `
402
+ <span style="font-size:0.9rem; font-weight:600; color:var(--accent-red)">${thinkText}</span>
403
+ <div class="ekg-loader">
404
+ <svg class="ekg-line" viewBox="0 0 50 20">
405
+ <path d="M0 10 L10 10 L15 0 L25 20 L30 10 L50 10" />
406
+ </svg>
407
+ </div>
408
+ `;
409
+ chatBox.appendChild(thinkingDiv);
410
+ chatBox.scrollTop = chatBox.scrollHeight;
411
+
412
+ // 3. Simulate AI Response (Aici se leaga Python/Groq)
413
+ // Simulam un delay de retea
414
+ setTimeout(() => {
415
+ thinkingDiv.remove();
416
+ const aiResponse = `**Analiză EKG:** Ritm sinusal normal. Frecvența cardiacă detectată: **72 BPM**.\n\nNu se observă anomalii ale segmentului ST. Continuați monitorizarea.`;
417
+ this.typeMessage(aiResponse);
418
+ }, 2000);
419
+ },
420
+
421
+ appendMessage: function(role, html) {
422
+ const div = document.createElement('div');
423
+ div.className = `message ${role === 'user' ? 'msg-user' : 'msg-ai'}`;
424
+ div.innerHTML = html;
425
+ document.getElementById('chat-container').appendChild(div);
426
+ document.getElementById('chat-container').scrollTop = document.getElementById('chat-container').scrollHeight;
427
+ },
428
+
429
+ typeMessage: async function(text) {
430
+ const div = document.createElement('div');
431
+ div.className = 'message msg-ai';
432
+ document.getElementById('chat-container').appendChild(div);
433
+
434
+ const words = text.split(' ');
435
+ let current = "";
436
+
437
+ for(let word of words) {
438
+ current += word + " ";
439
+ div.innerHTML = marked.parse(current);
440
+ document.getElementById('chat-container').scrollTop = document.getElementById('chat-container').scrollHeight;
441
+ await new Promise(r => setTimeout(r, 40)); // Typing speed
442
+ }
443
+
444
+ this.state.isTyping = false;
445
+ this.saveSession(document.getElementById('chat-container').innerHTML); // Save logic simplified
446
+ },
447
+
448
+ saveSession: function(htmlContent) {
449
+ // Simplified logic: update current session in array
450
+ let session = this.state.sessions.find(s => s.id === this.state.currentSessionId);
451
+ if(!session) {
452
+ session = {
453
+ id: this.state.currentSessionId,
454
+ title: `Session ${new Date().toLocaleTimeString()}`,
455
+ preview: 'Cardiac Analysis...'
456
+ };
457
+ this.state.sessions.unshift(session);
458
+ }
459
+ localStorage.setItem('beatai_pro_storage', JSON.stringify(this.state.sessions));
460
+ this.renderHistory();
461
+ },
462
+
463
+ renderHistory: function() {
464
+ const list = document.getElementById('history-list');
465
+ list.innerHTML = this.state.sessions.map(s => `
466
+ <div class="history-item">
467
+ <i class="ri-heart-pulse-line" style="color:var(--accent-red)"></i>
468
+ <div style="flex:1; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">
469
+ ${s.title}
470
+ </div>
471
+ </div>
472
+ `).join('');
473
+ }
474
+ };
475
+ </script>
476
+ </body>
477
+ </html>