Spaces:
Sleeping
Sleeping
Upload chat.html
Browse files- frontend/chat.html +0 -683
frontend/chat.html
CHANGED
|
@@ -270,692 +270,9 @@
|
|
| 270 |
<input type="password" id="authPassword" placeholder="••••••••" autocomplete="current-password">
|
| 271 |
</div>
|
| 272 |
<button class="auth-btn" id="authSubmitBtn" onclick="submitAuth()">Sign In</button>
|
| 273 |
-
<p id="forgotLink" style="text-align:center;margin-top:12px;font-size:13px;color:var(--muted);">
|
| 274 |
-
Forgot your password?
|
| 275 |
-
<a onclick="showForgotPassword()" style="color:var(--teal);cursor:pointer;text-decoration:underline;">Reset it</a>
|
| 276 |
-
</p>
|
| 277 |
</div>
|
| 278 |
</div>
|
| 279 |
|
| 280 |
-
<!-- FORGOT PASSWORD MODAL -->
|
| 281 |
-
<div id="forgotOverlay" style="position:fixed;inset:0;background:rgba(11,31,58,0.85);backdrop-filter:blur(6px);display:none;align-items:center;justify-content:center;z-index:2000;">
|
| 282 |
-
<div class="auth-card">
|
| 283 |
-
<div class="auth-logo">
|
| 284 |
-
<div class="auth-logo-mark">NC</div>
|
| 285 |
-
<div><h2>Reset Password</h2><p id="forgotStepLabel">Enter your registered email</p></div>
|
| 286 |
-
</div>
|
| 287 |
-
<div id="forgotError" class="auth-error"></div>
|
| 288 |
-
<div id="forgotSuccess" style="background:#D1FAE5;border:1px solid #6EE7B7;border-radius:8px;padding:10px 14px;font-size:13px;color:#065F46;margin-bottom:14px;display:none;"></div>
|
| 289 |
-
|
| 290 |
-
<!-- Step 1: Email -->
|
| 291 |
-
<div id="fpStep1">
|
| 292 |
-
<div class="auth-field">
|
| 293 |
-
<label>Email Address</label>
|
| 294 |
-
<input type="email" id="fpEmail" placeholder="your@email.com" autocomplete="email">
|
| 295 |
-
</div>
|
| 296 |
-
<button class="auth-btn" onclick="sendOTP()">Send Reset Code</button>
|
| 297 |
-
<button onclick="hideForgotPassword()" style="width:100%;padding:10px;background:none;border:1.5px solid var(--border);border-radius:9px;font-family:DM Sans,sans-serif;font-size:14px;color:var(--muted);cursor:pointer;margin-top:8px;">Cancel</button>
|
| 298 |
-
</div>
|
| 299 |
-
|
| 300 |
-
<!-- Step 2: OTP -->
|
| 301 |
-
<div id="fpStep2" style="display:none;">
|
| 302 |
-
<p style="font-size:13px;color:var(--muted);margin-bottom:16px;">A 6-digit code was sent to <strong id="fpEmailDisplay"></strong>. Enter it below:</p>
|
| 303 |
-
<div class="auth-field">
|
| 304 |
-
<label>Reset Code</label>
|
| 305 |
-
<input type="text" id="fpOTP" placeholder="000000" maxlength="6" style="letter-spacing:8px;font-size:22px;text-align:center;font-family:monospace;">
|
| 306 |
-
</div>
|
| 307 |
-
<button class="auth-btn" onclick="verifyOTP()">Verify Code</button>
|
| 308 |
-
<p style="text-align:center;margin-top:10px;font-size:12px;color:var(--muted);">
|
| 309 |
-
Didn't receive it? <a onclick="sendOTP()" style="color:var(--teal);cursor:pointer;">Resend</a>
|
| 310 |
-
</p>
|
| 311 |
-
</div>
|
| 312 |
-
|
| 313 |
-
<!-- Step 3: New Password -->
|
| 314 |
-
<div id="fpStep3" style="display:none;">
|
| 315 |
-
<div class="auth-field">
|
| 316 |
-
<label>New Password</label>
|
| 317 |
-
<input type="password" id="fpNewPw" placeholder="Min 6 characters">
|
| 318 |
-
</div>
|
| 319 |
-
<div class="auth-field">
|
| 320 |
-
<label>Confirm New Password</label>
|
| 321 |
-
<input type="password" id="fpConfirmPw" placeholder="Repeat new password">
|
| 322 |
-
</div>
|
| 323 |
-
<button class="auth-btn" onclick="submitNewPassword()">Set New Password</button>
|
| 324 |
-
</div>
|
| 325 |
-
</div>
|
| 326 |
-
</div>
|
| 327 |
-
|
| 328 |
-
<!-- APP SHELL -->
|
| 329 |
-
<div id="appShell">
|
| 330 |
-
<header>
|
| 331 |
-
<button class="sidebar-toggle" onclick="toggleSidebar()">☰</button>
|
| 332 |
-
<div class="logo-mark">NC</div>
|
| 333 |
-
<div class="header-text">
|
| 334 |
-
<h1>NeuroCheck AI</h1>
|
| 335 |
-
<p>MS Clinical Assistant · Powered by Llama 3.1 · RAG + NegEx</p>
|
| 336 |
-
</div>
|
| 337 |
-
<div class="header-right">
|
| 338 |
-
<span class="model-badge">🤖 Agentic AI</span>
|
| 339 |
-
<div class="user-pill" onclick="toggleUserMenu()">
|
| 340 |
-
<div class="user-avatar" id="headerAvatar">?</div>
|
| 341 |
-
<span class="user-name" id="headerUsername">…</span>
|
| 342 |
-
<div class="user-dropdown" id="userDropdown">
|
| 343 |
-
<a onclick="newChat()">+ New Chat</a>
|
| 344 |
-
<hr>
|
| 345 |
-
<a onclick="showChangePassword()">🔑 Change Password</a>
|
| 346 |
-
<a onclick="signOut()" class="danger">Sign Out</a>
|
| 347 |
-
</div>
|
| 348 |
-
</div>
|
| 349 |
-
</div>
|
| 350 |
-
</header>
|
| 351 |
-
|
| 352 |
-
<div class="main-body">
|
| 353 |
-
<div id="sidebar">
|
| 354 |
-
<div class="sidebar-header">
|
| 355 |
-
<span>Chat History</span>
|
| 356 |
-
<button class="new-chat-side" onclick="newChat()">+ New</button>
|
| 357 |
-
</div>
|
| 358 |
-
<div class="session-list" id="sessionList">
|
| 359 |
-
<div class="sidebar-empty" id="sidebarEmpty">No conversations yet.<br>Start a new chat!</div>
|
| 360 |
-
</div>
|
| 361 |
-
</div>
|
| 362 |
-
|
| 363 |
-
<!-- RISK PANEL -->
|
| 364 |
-
<div id="riskPanel" class="hidden">
|
| 365 |
-
<div class="rp-header">
|
| 366 |
-
<span>MS Risk Analysis</span>
|
| 367 |
-
<button class="rp-close" onclick="closeRiskPanel()" title="Close">✕</button>
|
| 368 |
-
</div>
|
| 369 |
-
<div class="rp-body" id="riskBody">
|
| 370 |
-
<div class="rp-idle" id="riskIdle">
|
| 371 |
-
<div class="idle-icon">🧠</div>
|
| 372 |
-
Describe your symptoms and the risk analysis will appear here automatically.
|
| 373 |
-
</div>
|
| 374 |
-
<div id="riskContent" style="display:none;">
|
| 375 |
-
<div class="rp-tier" id="rpTier">
|
| 376 |
-
<div class="rp-tier-label" id="rpTierLabel"></div>
|
| 377 |
-
<div class="rp-tier-sub" id="rpTierSub"></div>
|
| 378 |
-
</div>
|
| 379 |
-
<div id="rpFeaturesSection" style="display:none;">
|
| 380 |
-
<div class="rp-section-title">Detected Symptoms</div>
|
| 381 |
-
<div class="feature-list" id="rpFeatureList"></div>
|
| 382 |
-
</div>
|
| 383 |
-
<div id="rpWorkupSection" style="display:none;">
|
| 384 |
-
<div class="rp-section-title">Recommended Workup</div>
|
| 385 |
-
<div class="workup-list" id="rpWorkupList"></div>
|
| 386 |
-
</div>
|
| 387 |
-
<div class="action-box" id="rpActionBox" style="display:none;"></div>
|
| 388 |
-
</div>
|
| 389 |
-
</div>
|
| 390 |
-
</div>
|
| 391 |
-
|
| 392 |
-
<div class="chat-wrapper">
|
| 393 |
-
<div class="disclaimer-bar">Clinical decision support only — not a diagnosis</div>
|
| 394 |
-
<div class="chat-container">
|
| 395 |
-
<div class="messages" id="messages">
|
| 396 |
-
<div class="session-loading" id="sessionLoading">
|
| 397 |
-
<div class="spin"></div> Loading conversation…
|
| 398 |
-
</div>
|
| 399 |
-
<div class="welcome" id="welcome">
|
| 400 |
-
<div class="welcome-icon">🧠</div>
|
| 401 |
-
<h2>MS Clinical AI Assistant</h2>
|
| 402 |
-
<p>Describe your neurological symptoms in plain language. I will conduct a structured clinical interview, identify MS-specific patterns, and recommend the appropriate workup.</p>
|
| 403 |
-
<div class="welcome-chips">
|
| 404 |
-
<div class="chip" onclick="sendChip('I have been having blurry vision in my left eye for 3 days and pain when I move my eye.')">👁️ Vision symptoms</div>
|
| 405 |
-
<div class="chip" onclick="sendChip('Every time I bend my neck forward I get an electric shock running down my spine.')">⚡ Lhermitte sign</div>
|
| 406 |
-
<div class="chip" onclick="sendChip('I woke up seeing double and my eyes feel jiggly. I also feel like I am on a boat when walking.')">👀 Double vision + balance</div>
|
| 407 |
-
<div class="chip" onclick="sendChip('I have numbness and tingling in my right arm and leg that started 2 days ago.')">🦾 Numbness / tingling</div>
|
| 408 |
-
<div class="chip" onclick="sendChip('I feel a tight squeezing band around my chest like a corset being pulled tight.')">🎗️ MS Hug</div>
|
| 409 |
-
</div>
|
| 410 |
-
</div>
|
| 411 |
-
</div>
|
| 412 |
-
<div class="input-area">
|
| 413 |
-
<div class="input-controls">
|
| 414 |
-
<span class="session-id" id="sessionLabel"></span>
|
| 415 |
-
<button class="new-chat-btn" onclick="newChat()">+ New Chat</button>
|
| 416 |
-
</div>
|
| 417 |
-
<div class="input-row">
|
| 418 |
-
<textarea class="msg-input" id="msgInput" placeholder="Describe your symptoms… (Enter to send, Shift+Enter for new line)" rows="1"></textarea>
|
| 419 |
-
<button class="send-btn" id="sendBtn" onclick="sendMessage()">
|
| 420 |
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
| 421 |
-
<line x1="22" y1="2" x2="11" y2="13"></line>
|
| 422 |
-
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
|
| 423 |
-
</svg>
|
| 424 |
-
</button>
|
| 425 |
-
</div>
|
| 426 |
-
</div>
|
| 427 |
-
</div>
|
| 428 |
-
</div>
|
| 429 |
-
</div>
|
| 430 |
-
</div>
|
| 431 |
-
|
| 432 |
-
<script>
|
| 433 |
-
const API = window.location.origin;
|
| 434 |
-
let authToken = localStorage.getItem('nc_token') || null;
|
| 435 |
-
let currentUser = JSON.parse(localStorage.getItem('nc_user') || 'null');
|
| 436 |
-
let sessionId = null;
|
| 437 |
-
let isWaiting = false;
|
| 438 |
-
let currentTab = 'login';
|
| 439 |
-
|
| 440 |
-
// Bootstrap
|
| 441 |
-
window.addEventListener('DOMContentLoaded', () => {
|
| 442 |
-
document.getElementById('authPassword').addEventListener('keydown', e => { if(e.key==='Enter') submitAuth(); });
|
| 443 |
-
if (authToken && currentUser) showApp();
|
| 444 |
-
});
|
| 445 |
-
|
| 446 |
-
// ── Auth ──
|
| 447 |
-
function switchTab(tab) {
|
| 448 |
-
currentTab = tab;
|
| 449 |
-
document.getElementById('tabLogin').classList.toggle('active', tab==='login');
|
| 450 |
-
document.getElementById('tabRegister').classList.toggle('active', tab==='register');
|
| 451 |
-
document.getElementById('authSubmitBtn').textContent = tab==='login' ? 'Sign In' : 'Create Account';
|
| 452 |
-
document.querySelectorAll('.auth-register-only').forEach(el => el.style.display = tab==='register' ? 'block' : 'none');
|
| 453 |
-
document.getElementById('emailLabel').textContent = tab==='login' ? 'Email or Username' : 'Email';
|
| 454 |
-
const fl = document.getElementById('forgotLink');
|
| 455 |
-
if (fl) fl.style.display = tab==='login' ? 'block' : 'none';
|
| 456 |
-
clearAuthError();
|
| 457 |
-
}
|
| 458 |
-
|
| 459 |
-
function showAuthError(msg) { const e=document.getElementById('authError'); e.textContent=msg; e.style.display='block'; }
|
| 460 |
-
function clearAuthError() { document.getElementById('authError').style.display='none'; }
|
| 461 |
-
|
| 462 |
-
async function submitAuth() {
|
| 463 |
-
clearAuthError();
|
| 464 |
-
const btn = document.getElementById('authSubmitBtn');
|
| 465 |
-
btn.disabled = true;
|
| 466 |
-
const email = document.getElementById('authEmail').value.trim();
|
| 467 |
-
const password = document.getElementById('authPassword').value;
|
| 468 |
-
const username = document.getElementById('authUsername').value.trim();
|
| 469 |
-
if (!email || !password) { showAuthError('Please fill in all fields.'); btn.disabled=false; return; }
|
| 470 |
-
if (currentTab==='register' && !username) { showAuthError('Please enter a username.'); btn.disabled=false; return; }
|
| 471 |
-
try {
|
| 472 |
-
let res;
|
| 473 |
-
if (currentTab==='register') {
|
| 474 |
-
res = await fetch(`${API}/auth/register`, {
|
| 475 |
-
method:'POST', headers:{'Content-Type':'application/json'},
|
| 476 |
-
body: JSON.stringify({ username, email, password }),
|
| 477 |
-
});
|
| 478 |
-
} else {
|
| 479 |
-
const form = new URLSearchParams();
|
| 480 |
-
form.append('username', email);
|
| 481 |
-
form.append('password', password);
|
| 482 |
-
res = await fetch(`${API}/auth/login`, {
|
| 483 |
-
method:'POST', headers:{'Content-Type':'application/x-www-form-urlencoded'}, body: form,
|
| 484 |
-
});
|
| 485 |
-
}
|
| 486 |
-
let data;
|
| 487 |
-
try { data = await res.json(); } catch { throw new Error(`Server error ${res.status}`); }
|
| 488 |
-
if (!res.ok) {
|
| 489 |
-
// data.detail can be a string OR a list of validation error objects
|
| 490 |
-
let errMsg = 'Authentication failed';
|
| 491 |
-
if (data.detail) {
|
| 492 |
-
if (typeof data.detail === 'string') {
|
| 493 |
-
errMsg = data.detail;
|
| 494 |
-
} else if (Array.isArray(data.detail)) {
|
| 495 |
-
errMsg = data.detail.map(e => e.msg || JSON.stringify(e)).join(', ');
|
| 496 |
-
} else {
|
| 497 |
-
errMsg = JSON.stringify(data.detail);
|
| 498 |
-
}
|
| 499 |
-
}
|
| 500 |
-
throw new Error(errMsg);
|
| 501 |
-
}
|
| 502 |
-
authToken = data.access_token;
|
| 503 |
-
currentUser = { id: data.user_id, username: data.username };
|
| 504 |
-
localStorage.setItem('nc_token', authToken);
|
| 505 |
-
localStorage.setItem('nc_user', JSON.stringify(currentUser));
|
| 506 |
-
showApp();
|
| 507 |
-
} catch(err) { showAuthError(err.message); }
|
| 508 |
-
finally { btn.disabled = false; }
|
| 509 |
-
}
|
| 510 |
-
|
| 511 |
-
function signOut() {
|
| 512 |
-
localStorage.removeItem('nc_token'); localStorage.removeItem('nc_user');
|
| 513 |
-
authToken=null; currentUser=null; sessionId=null;
|
| 514 |
-
document.getElementById('appShell').classList.remove('visible');
|
| 515 |
-
document.getElementById('authOverlay').style.display='flex';
|
| 516 |
-
clearMessages();
|
| 517 |
-
}
|
| 518 |
-
|
| 519 |
-
// ── Shell ──
|
| 520 |
-
function showApp() {
|
| 521 |
-
document.getElementById('authOverlay').style.display='none';
|
| 522 |
-
document.getElementById('appShell').classList.add('visible');
|
| 523 |
-
document.getElementById('headerUsername').textContent = currentUser.username;
|
| 524 |
-
document.getElementById('headerAvatar').textContent = currentUser.username[0].toUpperCase();
|
| 525 |
-
loadSessionList();
|
| 526 |
-
}
|
| 527 |
-
|
| 528 |
-
function toggleUserMenu() { document.getElementById('userDropdown').classList.toggle('open'); }
|
| 529 |
-
document.addEventListener('click', e => { if (!e.target.closest('.user-pill')) document.getElementById('userDropdown').classList.remove('open'); });
|
| 530 |
-
function toggleSidebar() { document.getElementById('sidebar').classList.toggle('collapsed'); }
|
| 531 |
-
|
| 532 |
-
// ── Session list ──
|
| 533 |
-
async function loadSessionList() {
|
| 534 |
-
try {
|
| 535 |
-
const res = await authFetch('/user/sessions');
|
| 536 |
-
const data = await res.json();
|
| 537 |
-
renderSessionList(data.sessions || []);
|
| 538 |
-
} catch(e) { console.error(e); }
|
| 539 |
-
}
|
| 540 |
-
|
| 541 |
-
function renderSessionList(sessions) {
|
| 542 |
-
const list = document.getElementById('sessionList');
|
| 543 |
-
const empty = document.getElementById('sidebarEmpty');
|
| 544 |
-
list.querySelectorAll('.session-item').forEach(el => el.remove());
|
| 545 |
-
if (!sessions.length) { empty.style.display='block'; return; }
|
| 546 |
-
empty.style.display='none';
|
| 547 |
-
sessions.forEach(s => {
|
| 548 |
-
const item = document.createElement('div');
|
| 549 |
-
item.className = 'session-item' + (s.session_uuid===sessionId ? ' active' : '');
|
| 550 |
-
item.dataset.uuid = s.session_uuid;
|
| 551 |
-
const ts = new Date(s.updated_at).toLocaleDateString(undefined,{month:'short',day:'numeric'});
|
| 552 |
-
item.innerHTML = `
|
| 553 |
-
<div class="session-item-icon">💬</div>
|
| 554 |
-
<div class="session-item-body">
|
| 555 |
-
<div class="session-title">${escapeHtml(s.title||'Chat')}</div>
|
| 556 |
-
<div class="session-meta">${ts}</div>
|
| 557 |
-
</div>
|
| 558 |
-
<button class="session-delete" onclick="deleteSession(event,'${s.session_uuid}')">✕</button>`;
|
| 559 |
-
item.addEventListener('click', () => loadSession(s.session_uuid));
|
| 560 |
-
list.appendChild(item);
|
| 561 |
-
});
|
| 562 |
-
}
|
| 563 |
-
|
| 564 |
-
async function loadSession(uuid) {
|
| 565 |
-
if (uuid===sessionId) return;
|
| 566 |
-
sessionId = uuid;
|
| 567 |
-
document.querySelectorAll('.session-item').forEach(el => el.classList.toggle('active', el.dataset.uuid===uuid));
|
| 568 |
-
clearMessages();
|
| 569 |
-
const loading = document.getElementById('sessionLoading');
|
| 570 |
-
loading.classList.add('visible');
|
| 571 |
-
try {
|
| 572 |
-
const res = await authFetch(`/session/${uuid}/history`);
|
| 573 |
-
const data = await res.json();
|
| 574 |
-
loading.classList.remove('visible');
|
| 575 |
-
if (data.messages && data.messages.length) {
|
| 576 |
-
document.getElementById('welcome').style.display='none';
|
| 577 |
-
data.messages.forEach(m => addBubble(m.role==='human'?'user':'ai', m.content, m.created_at));
|
| 578 |
-
resetRiskPanel();
|
| 579 |
-
const humanText = data.messages.filter(m=>m.role==='human').map(m=>m.content).join(' ');
|
| 580 |
-
if (humanText.trim().length > 8) scheduleRiskUpdate(humanText);
|
| 581 |
-
}
|
| 582 |
-
} catch(e) { loading.classList.remove('visible'); }
|
| 583 |
-
document.getElementById('sessionLabel').textContent = `Session: ${uuid.slice(0,8)}…`;
|
| 584 |
-
}
|
| 585 |
-
|
| 586 |
-
async function deleteSession(e, uuid) {
|
| 587 |
-
e.stopPropagation();
|
| 588 |
-
if (!confirm('Delete this conversation?')) return;
|
| 589 |
-
await authFetch(`/session/${uuid}`, {method:'DELETE'}).catch(()=>{});
|
| 590 |
-
if (sessionId===uuid) { sessionId=null; clearMessages(); }
|
| 591 |
-
loadSessionList();
|
| 592 |
-
}
|
| 593 |
-
|
| 594 |
-
// ── Chat ──
|
| 595 |
-
const input = document.getElementById('msgInput');
|
| 596 |
-
input.addEventListener('input', () => { input.style.height='auto'; input.style.height=Math.min(input.scrollHeight,160)+'px'; });
|
| 597 |
-
input.addEventListener('keydown', e => { if (e.key==='Enter' && !e.shiftKey) { e.preventDefault(); sendMessage(); } });
|
| 598 |
-
|
| 599 |
-
function sendChip(text) { input.value=text; sendMessage(); }
|
| 600 |
-
|
| 601 |
-
async function sendMessage() {
|
| 602 |
-
const text = input.value.trim();
|
| 603 |
-
if (!text || isWaiting || !authToken) return;
|
| 604 |
-
isWaiting = true;
|
| 605 |
-
input.value = ''; input.style.height='auto';
|
| 606 |
-
document.getElementById('sendBtn').disabled = true;
|
| 607 |
-
document.getElementById('welcome').style.display='none';
|
| 608 |
-
addBubble('user', text, new Date().toISOString());
|
| 609 |
-
scheduleRiskUpdate(text);
|
| 610 |
-
const typing = addTyping();
|
| 611 |
-
try {
|
| 612 |
-
const res = await authFetch('/chat', {
|
| 613 |
-
method:'POST', headers:{'Content-Type':'application/json'},
|
| 614 |
-
body: JSON.stringify({ message: text, session_id: sessionId }),
|
| 615 |
-
});
|
| 616 |
-
if (res.status===401) { signOut(); return; }
|
| 617 |
-
if (!res.ok) { const err=await res.json().catch(()=>{}); throw new Error(err.detail||`Error ${res.status}`); }
|
| 618 |
-
const data = await res.json();
|
| 619 |
-
sessionId = data.session_id;
|
| 620 |
-
document.getElementById('sessionLabel').textContent = `Session: ${sessionId.slice(0,8)}…`;
|
| 621 |
-
typing.remove();
|
| 622 |
-
addBubble('ai', data.response, new Date().toISOString());
|
| 623 |
-
loadSessionList();
|
| 624 |
-
// Re-analyze with full accumulated text after every AI response
|
| 625 |
-
rebuildRiskFromHistory();
|
| 626 |
-
} catch(err) {
|
| 627 |
-
typing.remove();
|
| 628 |
-
addBubble('ai', `⚠️ Error: ${err.message}`, new Date().toISOString());
|
| 629 |
-
} finally {
|
| 630 |
-
isWaiting=false;
|
| 631 |
-
document.getElementById('sendBtn').disabled=false;
|
| 632 |
-
input.focus();
|
| 633 |
-
}
|
| 634 |
-
}
|
| 635 |
-
|
| 636 |
-
function newChat() {
|
| 637 |
-
sessionId=null;
|
| 638 |
-
clearMessages();
|
| 639 |
-
resetRiskPanel();
|
| 640 |
-
document.getElementById('sessionLabel').textContent='';
|
| 641 |
-
document.querySelectorAll('.session-item').forEach(el => el.classList.remove('active'));
|
| 642 |
-
loadSessionList();
|
| 643 |
-
input.focus();
|
| 644 |
-
}
|
| 645 |
-
|
| 646 |
-
function clearMessages() {
|
| 647 |
-
document.getElementById('messages').querySelectorAll('.msg-row').forEach(el => el.remove());
|
| 648 |
-
document.getElementById('welcome').style.display='flex';
|
| 649 |
-
}
|
| 650 |
-
|
| 651 |
-
function addBubble(role, text, timestamp) {
|
| 652 |
-
const msgs = document.getElementById('messages');
|
| 653 |
-
const row = document.createElement('div');
|
| 654 |
-
row.className = `msg-row ${role}`;
|
| 655 |
-
const avatar = document.createElement('div');
|
| 656 |
-
avatar.className = `avatar ${role}`;
|
| 657 |
-
avatar.textContent = role==='ai' ? 'NC' : (currentUser ? currentUser.username[0].toUpperCase() : 'U');
|
| 658 |
-
const inner = document.createElement('div');
|
| 659 |
-
const bubble = document.createElement('div');
|
| 660 |
-
bubble.className = `bubble ${role}`;
|
| 661 |
-
bubble.innerHTML = formatMessage(text);
|
| 662 |
-
const ts = document.createElement('div');
|
| 663 |
-
ts.className = 'msg-ts';
|
| 664 |
-
ts.textContent = formatTimestamp(timestamp);
|
| 665 |
-
inner.appendChild(bubble); inner.appendChild(ts);
|
| 666 |
-
row.appendChild(avatar); row.appendChild(inner);
|
| 667 |
-
msgs.appendChild(row); msgs.scrollTop=msgs.scrollHeight;
|
| 668 |
-
return row;
|
| 669 |
-
}
|
| 670 |
-
|
| 671 |
-
function addTyping() {
|
| 672 |
-
const msgs = document.getElementById('messages');
|
| 673 |
-
const row=document.createElement('div'); row.className='msg-row ai';
|
| 674 |
-
const av=document.createElement('div'); av.className='avatar ai'; av.textContent='NC';
|
| 675 |
-
const b=document.createElement('div'); b.className='typing-bubble';
|
| 676 |
-
b.innerHTML='<div class="dot"></div><div class="dot"></div><div class="dot"></div>';
|
| 677 |
-
row.appendChild(av); row.appendChild(b); msgs.appendChild(row); msgs.scrollTop=msgs.scrollHeight;
|
| 678 |
-
return row;
|
| 679 |
-
}
|
| 680 |
-
|
| 681 |
-
function formatTimestamp(iso) {
|
| 682 |
-
if (!iso) return '';
|
| 683 |
-
try {
|
| 684 |
-
const d=new Date(iso), now=new Date();
|
| 685 |
-
const sameDay = d.toDateString()===now.toDateString();
|
| 686 |
-
return sameDay
|
| 687 |
-
? d.toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'})
|
| 688 |
-
: d.toLocaleDateString([],{month:'short',day:'numeric'})+' '+d.toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'});
|
| 689 |
-
} catch { return ''; }
|
| 690 |
-
}
|
| 691 |
-
|
| 692 |
-
function formatMessage(text) {
|
| 693 |
-
let html = escapeHtml(text);
|
| 694 |
-
// Bold markdown **text**
|
| 695 |
-
html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
| 696 |
-
// Paragraphs and line breaks
|
| 697 |
-
html = html.replace(/\n\n/g, '</p><p>');
|
| 698 |
-
html = html.replace(/\n/g, '<br>');
|
| 699 |
-
// Bold key clinical terms — word boundaries only, no mid-word replacement
|
| 700 |
-
['MRI','lumbar puncture','oligoclonal bands','optic neuritis',
|
| 701 |
-
'Lhermitte','Uhthoff','neurology referral'
|
| 702 |
-
].forEach(kw => {
|
| 703 |
-
const re = new RegExp('(?<![\\w>])' + kw.replace(/[.*+?^${}()|[\]\\]/g,'\\$&') + '(?![\\w<])', 'gi');
|
| 704 |
-
html = html.replace(re, '<strong>$&</strong>');
|
| 705 |
-
});
|
| 706 |
-
return `<p>${html}</p>`;
|
| 707 |
-
}
|
| 708 |
-
|
| 709 |
-
function escapeHtml(t) { return t.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
| 710 |
-
|
| 711 |
-
function authFetch(path, opts={}) {
|
| 712 |
-
return fetch(`${API}${path}`, { ...opts, headers:{ ...(opts.headers||{}), 'Authorization':`Bearer ${authToken}` } });
|
| 713 |
-
}
|
| 714 |
-
// ── Live Risk Panel ───────────────────────────────────────��────────────────
|
| 715 |
-
let _riskDebounce = null;
|
| 716 |
-
let _riskText = '';
|
| 717 |
-
|
| 718 |
-
const TIER_COLORS = {
|
| 719 |
-
LOW: '#065F46',
|
| 720 |
-
WATCH: '#5B21B6',
|
| 721 |
-
MODERATE: '#1E40AF',
|
| 722 |
-
HIGH: '#92400E',
|
| 723 |
-
CRITICAL_EMERGENCY: '#B91C1C',
|
| 724 |
-
};
|
| 725 |
-
|
| 726 |
-
function closeRiskPanel() {
|
| 727 |
-
document.getElementById('riskPanel').classList.add('hidden');
|
| 728 |
-
}
|
| 729 |
-
|
| 730 |
-
function resetRiskPanel() {
|
| 731 |
-
_riskText = '';
|
| 732 |
-
document.getElementById('riskPanel').classList.add('hidden');
|
| 733 |
-
document.getElementById('riskIdle').style.display = 'block';
|
| 734 |
-
document.getElementById('riskContent').style.display = 'none';
|
| 735 |
-
}
|
| 736 |
-
|
| 737 |
-
function scheduleRiskUpdate(text) {
|
| 738 |
-
if (!text || text.trim().length < 3) return;
|
| 739 |
-
// Always append new text to accumulate full conversation context
|
| 740 |
-
_riskText = (_riskText + ' ' + text).trim();
|
| 741 |
-
clearTimeout(_riskDebounce);
|
| 742 |
-
_riskDebounce = setTimeout(() => _fetchRisk(_riskText), 700);
|
| 743 |
-
}
|
| 744 |
-
|
| 745 |
-
function rebuildRiskFromHistory() {
|
| 746 |
-
// Re-run analysis using ALL human messages in current conversation
|
| 747 |
-
const msgs = document.getElementById('messages').querySelectorAll('.msg-row.user .bubble');
|
| 748 |
-
const allText = Array.from(msgs).map(b => b.innerText || b.textContent).join(' ').trim();
|
| 749 |
-
if (allText.length > 5) {
|
| 750 |
-
_riskText = allText;
|
| 751 |
-
_fetchRisk(_riskText);
|
| 752 |
-
}
|
| 753 |
-
}
|
| 754 |
-
|
| 755 |
-
async function _fetchRisk(text) {
|
| 756 |
-
try {
|
| 757 |
-
const res = await fetch(`${API}/analyze`, {
|
| 758 |
-
method: 'POST',
|
| 759 |
-
headers: { 'Content-Type': 'application/json' },
|
| 760 |
-
body: JSON.stringify({ text }),
|
| 761 |
-
});
|
| 762 |
-
if (!res.ok) return;
|
| 763 |
-
renderRiskPanel(await res.json());
|
| 764 |
-
} catch(e) { /* silent */ }
|
| 765 |
-
}
|
| 766 |
-
|
| 767 |
-
function renderRiskPanel(data) {
|
| 768 |
-
const tier = data.tier || 'LOW';
|
| 769 |
-
const color = TIER_COLORS[tier] || TIER_COLORS.LOW;
|
| 770 |
-
document.getElementById('riskPanel').classList.remove('hidden');
|
| 771 |
-
document.getElementById('riskIdle').style.display = 'none';
|
| 772 |
-
document.getElementById('riskContent').style.display = 'block';
|
| 773 |
-
const lbl = document.getElementById('rpTierLabel');
|
| 774 |
-
lbl.textContent = data.tier_label || tier;
|
| 775 |
-
lbl.className = 'rp-tier-label tier-color-' + tier;
|
| 776 |
-
document.getElementById('rpTierSub').textContent = data.tier_subtitle || '';
|
| 777 |
-
const feats = data.features || [];
|
| 778 |
-
const fSec = document.getElementById('rpFeaturesSection');
|
| 779 |
-
if (feats.length) {
|
| 780 |
-
fSec.style.display = 'block';
|
| 781 |
-
document.getElementById('rpFeatureList').innerHTML =
|
| 782 |
-
feats.map(f => `<div class="feature-chip">${escapeHtml(f.label)}</div>`).join('');
|
| 783 |
-
} else { fSec.style.display = 'none'; }
|
| 784 |
-
const workup = data.workup || [];
|
| 785 |
-
const wSec = document.getElementById('rpWorkupSection');
|
| 786 |
-
if (workup.length) {
|
| 787 |
-
wSec.style.display = 'block';
|
| 788 |
-
document.getElementById('rpWorkupList').innerHTML =
|
| 789 |
-
workup.map(w => `<div class="workup-item">${escapeHtml(w)}</div>`).join('');
|
| 790 |
-
} else { wSec.style.display = 'none'; }
|
| 791 |
-
const aBox = document.getElementById('rpActionBox');
|
| 792 |
-
if (data.action && tier !== 'LOW') {
|
| 793 |
-
aBox.style.display = 'block';
|
| 794 |
-
aBox.style.borderColor = color;
|
| 795 |
-
aBox.innerHTML = `<strong>Recommended action:</strong><br>${escapeHtml(data.action)}`;
|
| 796 |
-
} else { aBox.style.display = 'none'; }
|
| 797 |
-
}
|
| 798 |
-
|
| 799 |
-
// ── Forgot Password ────────────────────────────────────────────────────────
|
| 800 |
-
let _resetToken = '';
|
| 801 |
-
|
| 802 |
-
function showForgotPassword() {
|
| 803 |
-
document.getElementById('forgotOverlay').style.display = 'flex';
|
| 804 |
-
document.getElementById('fpStep1').style.display = 'block';
|
| 805 |
-
document.getElementById('fpStep2').style.display = 'none';
|
| 806 |
-
document.getElementById('fpStep3').style.display = 'none';
|
| 807 |
-
document.getElementById('forgotError').style.display = 'none';
|
| 808 |
-
document.getElementById('forgotSuccess').style.display = 'none';
|
| 809 |
-
document.getElementById('forgotStepLabel').textContent = 'Enter your registered email';
|
| 810 |
-
document.getElementById('fpEmail').value = '';
|
| 811 |
-
document.getElementById('fpOTP').value = '';
|
| 812 |
-
document.getElementById('fpNewPw').value = '';
|
| 813 |
-
document.getElementById('fpConfirmPw').value = '';
|
| 814 |
-
}
|
| 815 |
-
|
| 816 |
-
function hideForgotPassword() {
|
| 817 |
-
document.getElementById('forgotOverlay').style.display = 'none';
|
| 818 |
-
}
|
| 819 |
-
|
| 820 |
-
function fpShowError(msg) {
|
| 821 |
-
const e = document.getElementById('forgotError');
|
| 822 |
-
e.textContent = msg; e.style.display = 'block';
|
| 823 |
-
document.getElementById('forgotSuccess').style.display = 'none';
|
| 824 |
-
}
|
| 825 |
-
|
| 826 |
-
function fpShowSuccess(msg) {
|
| 827 |
-
const s = document.getElementById('forgotSuccess');
|
| 828 |
-
s.textContent = msg; s.style.display = 'block';
|
| 829 |
-
document.getElementById('forgotError').style.display = 'none';
|
| 830 |
-
}
|
| 831 |
-
|
| 832 |
-
async function sendOTP() {
|
| 833 |
-
const email = document.getElementById('fpEmail').value.trim();
|
| 834 |
-
if (!email) { fpShowError('Please enter your email address.'); return; }
|
| 835 |
-
fpShowError('');
|
| 836 |
-
try {
|
| 837 |
-
const res = await fetch(`${API}/auth/forgot-password`, {
|
| 838 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 839 |
-
body: JSON.stringify({ email }),
|
| 840 |
-
});
|
| 841 |
-
const data = await res.json();
|
| 842 |
-
// Show step 2 regardless (don't reveal if email exists)
|
| 843 |
-
document.getElementById('fpEmailDisplay').textContent = email;
|
| 844 |
-
document.getElementById('fpStep1').style.display = 'none';
|
| 845 |
-
document.getElementById('fpStep2').style.display = 'block';
|
| 846 |
-
document.getElementById('forgotStepLabel').textContent = 'Enter the code from your email';
|
| 847 |
-
fpShowSuccess('Reset code sent! Check your inbox (and spam folder).');
|
| 848 |
-
document.getElementById('fpOTP').focus();
|
| 849 |
-
} catch(e) { fpShowError('Could not send reset code. Please try again.'); }
|
| 850 |
-
}
|
| 851 |
-
|
| 852 |
-
async function verifyOTP() {
|
| 853 |
-
const email = document.getElementById('fpEmail').value.trim();
|
| 854 |
-
const otp = document.getElementById('fpOTP').value.trim();
|
| 855 |
-
if (!otp || otp.length < 6) { fpShowError('Please enter the 6-digit code.'); return; }
|
| 856 |
-
try {
|
| 857 |
-
const res = await fetch(`${API}/auth/verify-otp`, {
|
| 858 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 859 |
-
body: JSON.stringify({ email, otp }),
|
| 860 |
-
});
|
| 861 |
-
const data = await res.json();
|
| 862 |
-
if (!res.ok) throw new Error(data.detail || 'Invalid code');
|
| 863 |
-
_resetToken = data.reset_token;
|
| 864 |
-
document.getElementById('fpStep2').style.display = 'none';
|
| 865 |
-
document.getElementById('fpStep3').style.display = 'block';
|
| 866 |
-
document.getElementById('forgotStepLabel').textContent = 'Set your new password';
|
| 867 |
-
document.getElementById('forgotSuccess').style.display = 'none';
|
| 868 |
-
document.getElementById('fpNewPw').focus();
|
| 869 |
-
} catch(e) { fpShowError(e.message); }
|
| 870 |
-
}
|
| 871 |
-
|
| 872 |
-
async function submitNewPassword() {
|
| 873 |
-
const newPw = document.getElementById('fpNewPw').value;
|
| 874 |
-
const confPw = document.getElementById('fpConfirmPw').value;
|
| 875 |
-
if (!newPw || newPw.length < 6) { fpShowError('Password must be at least 6 characters.'); return; }
|
| 876 |
-
if (newPw !== confPw) { fpShowError('Passwords do not match.'); return; }
|
| 877 |
-
try {
|
| 878 |
-
const res = await fetch(`${API}/auth/reset-password`, {
|
| 879 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 880 |
-
body: JSON.stringify({ reset_token: _resetToken, new_password: newPw }),
|
| 881 |
-
});
|
| 882 |
-
const data = await res.json();
|
| 883 |
-
if (!res.ok) throw new Error(data.detail || 'Reset failed');
|
| 884 |
-
fpShowSuccess('✅ Password reset! Redirecting to login…');
|
| 885 |
-
setTimeout(() => {
|
| 886 |
-
hideForgotPassword();
|
| 887 |
-
switchTab('login');
|
| 888 |
-
}, 2000);
|
| 889 |
-
} catch(e) { fpShowError(e.message); }
|
| 890 |
-
}
|
| 891 |
-
|
| 892 |
-
// ── Change Password ────────────────────────────────────────────────────────
|
| 893 |
-
function showChangePassword() {
|
| 894 |
-
document.getElementById('userDropdown').classList.remove('open');
|
| 895 |
-
document.getElementById('changePwOverlay').style.display = 'flex';
|
| 896 |
-
document.getElementById('pwOld').value = '';
|
| 897 |
-
document.getElementById('pwNew').value = '';
|
| 898 |
-
document.getElementById('pwConfirm').value = '';
|
| 899 |
-
document.getElementById('changePwError').style.display = 'none';
|
| 900 |
-
document.getElementById('changePwSuccess').style.display = 'none';
|
| 901 |
-
document.getElementById('pwOld').focus();
|
| 902 |
-
}
|
| 903 |
-
|
| 904 |
-
function hideChangePassword() {
|
| 905 |
-
document.getElementById('changePwOverlay').style.display = 'none';
|
| 906 |
-
}
|
| 907 |
-
|
| 908 |
-
async function submitChangePassword() {
|
| 909 |
-
const oldPw = document.getElementById('pwOld').value;
|
| 910 |
-
const newPw = document.getElementById('pwNew').value;
|
| 911 |
-
const confPw = document.getElementById('pwConfirm').value;
|
| 912 |
-
const errEl = document.getElementById('changePwError');
|
| 913 |
-
const okEl = document.getElementById('changePwSuccess');
|
| 914 |
-
errEl.style.display = 'none';
|
| 915 |
-
okEl.style.display = 'none';
|
| 916 |
-
|
| 917 |
-
if (!oldPw || !newPw || !confPw) {
|
| 918 |
-
errEl.textContent = 'Please fill in all fields.';
|
| 919 |
-
errEl.style.display = 'block'; return;
|
| 920 |
-
}
|
| 921 |
-
if (newPw.length < 6) {
|
| 922 |
-
errEl.textContent = 'New password must be at least 6 characters.';
|
| 923 |
-
errEl.style.display = 'block'; return;
|
| 924 |
-
}
|
| 925 |
-
if (newPw !== confPw) {
|
| 926 |
-
errEl.textContent = 'New passwords do not match.';
|
| 927 |
-
errEl.style.display = 'block'; return;
|
| 928 |
-
}
|
| 929 |
-
|
| 930 |
-
try {
|
| 931 |
-
const res = await authFetch('/auth/change-password', {
|
| 932 |
-
method: 'POST',
|
| 933 |
-
headers: { 'Content-Type': 'application/json' },
|
| 934 |
-
body: JSON.stringify({ old_password: oldPw, new_password: newPw }),
|
| 935 |
-
});
|
| 936 |
-
const data = await res.json();
|
| 937 |
-
if (!res.ok) throw new Error(data.detail || 'Failed to change password');
|
| 938 |
-
okEl.textContent = '✅ Password changed successfully!';
|
| 939 |
-
okEl.style.display = 'block';
|
| 940 |
-
setTimeout(hideChangePassword, 2000);
|
| 941 |
-
} catch(e) {
|
| 942 |
-
errEl.textContent = e.message;
|
| 943 |
-
errEl.style.display = 'block';
|
| 944 |
-
}
|
| 945 |
-
}
|
| 946 |
-
|
| 947 |
-
// Close modal on background click
|
| 948 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 949 |
-
const cpOverlay = document.getElementById('changePwOverlay');
|
| 950 |
-
if (cpOverlay) cpOverlay.addEventListener('click', function(e) {
|
| 951 |
-
if (e.target === this) hideChangePassword();
|
| 952 |
-
});
|
| 953 |
-
document.getElementById('pwConfirm').addEventListener('keydown', e => {
|
| 954 |
-
if (e.key === 'Enter') submitChangePassword();
|
| 955 |
-
});
|
| 956 |
-
});
|
| 957 |
-
</script>
|
| 958 |
-
|
| 959 |
<!-- CHANGE PASSWORD MODAL -->
|
| 960 |
<div id="changePwOverlay" style="position:fixed;inset:0;background:rgba(11,31,58,0.7);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;z-index:500;">
|
| 961 |
<div class="changepw-card">
|
|
|
|
| 270 |
<input type="password" id="authPassword" placeholder="••••••••" autocomplete="current-password">
|
| 271 |
</div>
|
| 272 |
<button class="auth-btn" id="authSubmitBtn" onclick="submitAuth()">Sign In</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
</div>
|
| 274 |
</div>
|
| 275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
<!-- CHANGE PASSWORD MODAL -->
|
| 277 |
<div id="changePwOverlay" style="position:fixed;inset:0;background:rgba(11,31,58,0.7);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;z-index:500;">
|
| 278 |
<div class="changepw-card">
|