Update DMH Hospital Diabetic Dost
This commit is contained in:
@@ -4,16 +4,16 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chellaram Hospital — Admin Consultations Portal</title>
|
||||
<title>Dinanath Mangeshkar Hospital — Admin Consultations Portal</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap"
|
||||
rel="stylesheet">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="shortcut icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="apple-touch-icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="shortcut icon" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="apple-touch-icon" href="/static/dmh_logo.png?v=dmh">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
@@ -807,9 +807,9 @@
|
||||
LOGIN VIEW
|
||||
========================================== -->
|
||||
<div id="login-view" class="login-container" style="display: none;">
|
||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
||||
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||
style="height: 60px; width: auto; max-width: 230px; border-radius: 12px; object-fit: contain; margin: 0 auto 14px auto; display: block; box-shadow: 0 4px 14px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 12px;">
|
||||
<h2>Chellaram Hospital Admin</h2>
|
||||
<h2>Dinanath Mangeshkar Hospital Admin</h2>
|
||||
<p>Sign in to review clinical voice consultations & patient triage reports</p>
|
||||
|
||||
<div id="login-error" class="login-error-msg"></div>
|
||||
@@ -841,10 +841,10 @@
|
||||
<!-- Top Header -->
|
||||
<header class="admin-header">
|
||||
<a href="/" class="brand-wrap">
|
||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
||||
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||
style="height: 42px; width: auto; max-width: 170px; border-radius: 8px; object-fit: contain; box-shadow: 0 2px 8px rgba(14, 165, 168, 0.2); background: #ffffff; padding: 2px 6px;">
|
||||
<div class="brand-text">
|
||||
<h1>Chellaram Hospital — Admin Portal</h1>
|
||||
<h1>Dinanath Mangeshkar Hospital — Admin Portal</h1>
|
||||
<p>Consultation Records & Clinical Triage Database</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chellaram Hospital — Diabetes Dost 🩺</title>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="shortcut icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<link rel="apple-touch-icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
||||
<title>Dinanath Mangeshkar Hospital — Diabetes Dost 🩺</title>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="shortcut icon" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="apple-touch-icon" href="/static/dmh_logo.png?v=dmh">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link
|
||||
@@ -1114,6 +1114,28 @@
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.btn-pill-action.send-speech-active {
|
||||
background: #10b981;
|
||||
border-color: #059669;
|
||||
color: #ffffff;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
|
||||
transition: all 0.2s ease;
|
||||
animation: pulseGreen 1.8s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.btn-pill-action.send-speech-active:hover {
|
||||
background: #059669;
|
||||
color: #ffffff;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
|
||||
}
|
||||
|
||||
@keyframes pulseGreen {
|
||||
0%, 100% { box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35); }
|
||||
50% { box-shadow: 0 4px 18px rgba(16, 185, 129, 0.6); }
|
||||
}
|
||||
|
||||
/* Bottom 3 Feature Cards & Tagline */
|
||||
.bottom-features-section {
|
||||
display: flex;
|
||||
@@ -2242,9 +2264,9 @@
|
||||
======================================================== -->
|
||||
<header class="main-header">
|
||||
<div class="header-left">
|
||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital Logo" class="brand-logo-img">
|
||||
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital Logo" class="brand-logo-img">
|
||||
<div class="brand-titles">
|
||||
<h1>Chellaram Hospital</h1>
|
||||
<h1>Dinanath Mangeshkar Hospital</h1>
|
||||
<p>Diabetes Dost — Care Companion</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2491,6 +2513,10 @@
|
||||
<button class="btn-pill-action pause-active" id="btn-pause-resume" onclick="togglePauseMic()">
|
||||
<span>⏸️</span> Pause
|
||||
</button>
|
||||
|
||||
<button class="btn-pill-action send-speech-active" id="btn-send-speech" onclick="manualSubmitSpeech()" style="display: none;" title="पूर्ण झाले? उत्तर पाठवा / Send Answer">
|
||||
<span>✅</span> उत्तर पाठवा (Send)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Chat Messages Scroll Container -->
|
||||
@@ -2687,9 +2713,13 @@
|
||||
let recognition = null;
|
||||
let currentSttLang = 'hi-IN';
|
||||
let silenceTimer = null;
|
||||
let pauseFeedbackTimer = null;
|
||||
let speechWatchdogInterval = null;
|
||||
let speechSafetyTimeout = null;
|
||||
let currentAccumulatedSpeech = '';
|
||||
let confirmedSpeechHistory = '';
|
||||
let currentSessionTranscript = '';
|
||||
let naturalPauseWaitMs = 4500; // 4.5 seconds generous pause tolerance for natural speech
|
||||
let currentLivePatientRow = null;
|
||||
let lastBotPromptText = 'ही तहान तुम्हाला किती दिवसांपासून जाणवते?';
|
||||
let lastBotAudioUrl = null;
|
||||
@@ -2739,6 +2769,10 @@
|
||||
if (recognition) {
|
||||
recognition.lang = currentSttLang;
|
||||
}
|
||||
const sendBtn = document.getElementById('btn-send-speech');
|
||||
if (sendBtn) {
|
||||
sendBtn.innerHTML = currentSttLang === 'mr-IN' ? '<span>✅</span> उत्तर पाठवा' : '<span>✅</span> भेजें (Send)';
|
||||
}
|
||||
setupVoices();
|
||||
}
|
||||
|
||||
@@ -2854,6 +2888,26 @@
|
||||
.trim();
|
||||
}
|
||||
|
||||
function resetSpeechAccumulator() {
|
||||
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||
confirmedSpeechHistory = '';
|
||||
currentSessionTranscript = '';
|
||||
currentAccumulatedSpeech = '';
|
||||
const sendBtn = document.getElementById('btn-send-speech');
|
||||
if (sendBtn) sendBtn.style.display = 'none';
|
||||
}
|
||||
|
||||
function manualSubmitSpeech() {
|
||||
if (isBotSpeaking || isConversationStopped) return;
|
||||
const textToSend = (currentAccumulatedSpeech || '').trim();
|
||||
if (textToSend) {
|
||||
resetSpeechAccumulator();
|
||||
stopListening();
|
||||
sendVoiceTurn(textToSend);
|
||||
}
|
||||
}
|
||||
|
||||
function initSpeechRecognition() {
|
||||
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) return;
|
||||
const SpeechRec = window.SpeechRecognition || window.webkitSpeechRecognition;
|
||||
@@ -2883,37 +2937,72 @@
|
||||
stopAnyBotSpeech();
|
||||
}
|
||||
|
||||
let sessionTranscript = '';
|
||||
// Reset pause timers because the patient is actively speaking
|
||||
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||
|
||||
let sessionFinal = '';
|
||||
let sessionInterim = '';
|
||||
for (let i = 0; i < event.results.length; ++i) {
|
||||
if (event.results[i] && event.results[i][0]) {
|
||||
sessionTranscript += event.results[i][0].transcript + ' ';
|
||||
const res = event.results[i];
|
||||
if (res && res[0]) {
|
||||
if (res.isFinal) {
|
||||
sessionFinal += res[0].transcript + ' ';
|
||||
} else {
|
||||
sessionInterim += res[0].transcript + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rawCombined = (currentAccumulatedSpeech + ' ' + sessionTranscript).trim();
|
||||
const cleanDisplay = cleanSpokenTranscript(rawCombined);
|
||||
currentSessionTranscript = (sessionFinal + ' ' + sessionInterim).trim();
|
||||
|
||||
// Overall speech integrates previously accumulated sentences across pauses + current segment
|
||||
const combinedSpeech = cleanSpokenTranscript((confirmedSpeechHistory + ' ' + currentSessionTranscript).trim());
|
||||
|
||||
if (combinedSpeech) {
|
||||
currentAccumulatedSpeech = combinedSpeech;
|
||||
updatePatientLiveBubble(combinedSpeech);
|
||||
|
||||
if (cleanDisplay) {
|
||||
updatePatientLiveBubble(cleanDisplay);
|
||||
const lbl = document.getElementById('orb-dock-status');
|
||||
const sub = document.getElementById('orb-dock-subtext');
|
||||
if (lbl) lbl.textContent = '👂 Listening carefully...';
|
||||
const sendBtn = document.getElementById('btn-send-speech');
|
||||
|
||||
if (lbl) {
|
||||
lbl.textContent = currentSttLang === 'mr-IN'
|
||||
? '👂 ऐकतोय... (बोलत राहा)'
|
||||
: '👂 सुन रहे हैं... (बोलते रहिए)';
|
||||
}
|
||||
if (sub) {
|
||||
sub.textContent = '🗣️ "' + cleanDisplay + '" (Speak at your own pace...)';
|
||||
sub.textContent = '🗣️ "' + combinedSpeech + '"';
|
||||
sub.style.color = '#38bdf8';
|
||||
sub.style.fontWeight = '600';
|
||||
}
|
||||
if (silenceTimer) clearTimeout(silenceTimer);
|
||||
if (sendBtn) {
|
||||
sendBtn.style.display = 'inline-flex';
|
||||
sendBtn.title = currentSttLang === 'mr-IN' ? 'पूर्ण झाले? उत्तर पाठवा' : 'हो गया? उत्तर भेजें';
|
||||
sendBtn.innerHTML = currentSttLang === 'mr-IN' ? '<span>✅</span> उत्तर पाठवा' : '<span>✅</span> भेजें (Send)';
|
||||
}
|
||||
|
||||
// Generous natural pause (2500ms): ensures patient finishes full multi-phrase sentence without punctuation truncation
|
||||
// Gentle pause indicator: after 1.5s of natural pause, reassure user they have plenty of time
|
||||
pauseFeedbackTimer = setTimeout(() => {
|
||||
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||
if (lbl) {
|
||||
lbl.textContent = currentSttLang === 'mr-IN'
|
||||
? '⏳ वेळ घ्या, ऐकतोय... (किंवा Send दाबा)'
|
||||
: '⏳ समय लीजिए, सुन रहे हैं... (या Send दबाएं)';
|
||||
}
|
||||
}, 1500);
|
||||
|
||||
// Generous natural pause (4.5s): captures multi-phrase speech even if patient pauses to think or breathe
|
||||
silenceTimer = setTimeout(() => {
|
||||
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||
if (cleanDisplay) {
|
||||
currentAccumulatedSpeech = '';
|
||||
if (currentAccumulatedSpeech) {
|
||||
const finalSpeech = currentAccumulatedSpeech;
|
||||
resetSpeechAccumulator();
|
||||
stopListening();
|
||||
sendVoiceTurn(cleanDisplay);
|
||||
sendVoiceTurn(finalSpeech);
|
||||
}
|
||||
}, 2500);
|
||||
}, naturalPauseWaitMs);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2925,10 +3014,19 @@
|
||||
};
|
||||
|
||||
recognition.onend = function () {
|
||||
// If recognition was ended by browser on silence/pause while listening is still active:
|
||||
if (isListeningActive && !isMicPaused && !isConversationStopped && !isBotSpeaking) {
|
||||
// Consolidate currentSessionTranscript into confirmedSpeechHistory so NOTHING is lost
|
||||
if (currentSessionTranscript) {
|
||||
confirmedSpeechHistory = cleanSpokenTranscript((confirmedSpeechHistory + ' ' + currentSessionTranscript).trim());
|
||||
currentSessionTranscript = '';
|
||||
}
|
||||
// Seamlessly restart recognition so patient can resume speaking without losing earlier words
|
||||
setTimeout(() => {
|
||||
try { recognition.start(); } catch (e) { }
|
||||
}, 100);
|
||||
if (isListeningActive && !isMicPaused && !isConversationStopped && !isBotSpeaking) {
|
||||
try { recognition.start(); } catch (e) { }
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
};
|
||||
} catch (e) { }
|
||||
@@ -2938,8 +3036,7 @@
|
||||
|
||||
async function startListening() {
|
||||
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||
if (silenceTimer) clearTimeout(silenceTimer);
|
||||
currentAccumulatedSpeech = '';
|
||||
resetSpeechAccumulator();
|
||||
currentLivePatientRow = null;
|
||||
|
||||
await requestMicPermission();
|
||||
@@ -2963,10 +3060,13 @@
|
||||
|
||||
function stopListening() {
|
||||
isListeningActive = false;
|
||||
if (silenceTimer) clearTimeout(silenceTimer);
|
||||
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||
if (recognition) {
|
||||
try { recognition.abort(); } catch (e) { }
|
||||
}
|
||||
const sendBtn = document.getElementById('btn-send-speech');
|
||||
if (sendBtn) sendBtn.style.display = 'none';
|
||||
updateOrbUI(isMicPaused ? 'paused' : 'idle');
|
||||
}
|
||||
|
||||
@@ -2979,11 +3079,9 @@
|
||||
initiateVoiceSessionWithUserGesture();
|
||||
return;
|
||||
}
|
||||
// If user has spoken something and clicks the orb, immediately send their full answer!
|
||||
if (isListeningActive && currentAccumulatedSpeech.trim()) {
|
||||
const fullText = currentAccumulatedSpeech.trim();
|
||||
currentAccumulatedSpeech = '';
|
||||
stopListening();
|
||||
sendVoiceTurn(fullText);
|
||||
manualSubmitSpeech();
|
||||
return;
|
||||
}
|
||||
togglePauseMic();
|
||||
@@ -4321,7 +4419,7 @@
|
||||
<div>
|
||||
<div
|
||||
style="font-size:0.68rem; font-weight:800; color:#0b8082; text-transform:uppercase; letter-spacing:0.5px;">
|
||||
🏥 Chellaram Hospital
|
||||
🏥 Dinanath Mangeshkar Hospital
|
||||
</div>
|
||||
<h3
|
||||
style="font-family:'Outfit',sans-serif; font-size:1.18rem; font-weight:800; color:#0f172a; margin:2px 0 0 0;">
|
||||
@@ -4426,10 +4524,10 @@
|
||||
onclick="if(event.target.id === 'admin-login-modal') closeAdminLoginModal()">
|
||||
<div
|
||||
style="background: #ffffff; border-radius: 16px; padding: 28px 24px; max-width: 400px; width: 100%; box-shadow: var(--shadow-lg); text-align: center; border: 1px solid var(--card-border);">
|
||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
||||
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||
style="height: 54px; width: auto; max-width: 220px; border-radius: 12px; object-fit: contain; margin: 0 auto 12px auto; display: block; box-shadow: 0 4px 12px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 10px;">
|
||||
<h3 style="font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 800; color: var(--blue-navy);">
|
||||
Chellaram Hospital Admin
|
||||
Dinanath Mangeshkar Hospital Admin
|
||||
</h3>
|
||||
<p style="font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; margin-bottom: 18px;">
|
||||
Sign in to view all patient consultations & SQLite records
|
||||
|
||||
Reference in New Issue
Block a user