feat(diarization): Sub-Phase 3B - multi-speaker auto-detection and clinical role guardrails
This commit is contained in:
+13
-2
@@ -524,6 +524,15 @@
|
||||
startSarvamLiveStream(mediaStream);
|
||||
}
|
||||
|
||||
function getSelectedSpeakerCount() {
|
||||
const select = document.getElementById('speakerModeSelect');
|
||||
if (!select) return null;
|
||||
const val = select.value;
|
||||
if (!val || val === 'auto') return null;
|
||||
const num = parseInt(val, 10);
|
||||
return isNaN(num) || num < 2 ? null : num;
|
||||
}
|
||||
|
||||
async function stopAndSummarize() {
|
||||
if (!recording) return;
|
||||
recording = false;
|
||||
@@ -551,6 +560,7 @@
|
||||
const wavBuffer = buildWav(pcmChunks, SAMPLE_RATE);
|
||||
const audio_b64 = bufferToBase64(wavBuffer);
|
||||
const lang = langSelect.value;
|
||||
const num_speakers = getSelectedSpeakerCount();
|
||||
|
||||
// Setup playable audio blob for synchronized playback
|
||||
setupAudioPlayer(wavBuffer, secondsElapsed);
|
||||
@@ -558,7 +568,7 @@
|
||||
const resp = await fetch('/api/transcribe', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ audio_b64, language_code: lang, num_speakers: 2 })
|
||||
body: JSON.stringify({ audio_b64, language_code: lang, num_speakers })
|
||||
});
|
||||
|
||||
const data = await resp.json();
|
||||
@@ -1057,11 +1067,12 @@
|
||||
// Call /api/transcribe which runs STT + NVIDIA NeMo Diarization on the server
|
||||
const audio_b64 = bufferToBase64(fullWavBuffer);
|
||||
const lang = langSelect.value;
|
||||
const num_speakers = getSelectedSpeakerCount();
|
||||
|
||||
const transcribePromise = fetch('/api/transcribe', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ audio_b64, language_code: lang, num_speakers: 2 })
|
||||
body: JSON.stringify({ audio_b64, language_code: lang, num_speakers })
|
||||
}).then(async resp => {
|
||||
const data = await resp.json();
|
||||
if (!resp.ok) throw new Error(data.error || 'Server error');
|
||||
|
||||
@@ -196,6 +196,21 @@
|
||||
<input type="text" id="consultationDate" value="09-09-2026">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Speaker Diarization Mode -->
|
||||
<div class="form-group">
|
||||
<label for="speakerModeSelect" class="form-label">Speakers / Diarization</label>
|
||||
<div class="input-icon-box select-box">
|
||||
<span class="input-icon">👥</span>
|
||||
<select id="speakerModeSelect">
|
||||
<option value="auto" selected>Auto-Detect (2+ Speakers)</option>
|
||||
<option value="2">2 Speakers (Doctor & Patient)</option>
|
||||
<option value="3">3 Speakers (Doctor, Patient, Relative)</option>
|
||||
<option value="4">4 Speakers (Doctor, Patient, Relative, Nurse)</option>
|
||||
</select>
|
||||
<span class="select-chevron">▾</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+1
-1
@@ -525,7 +525,7 @@ html, body {
|
||||
══════════════════════════════════════════════════════════════════ */
|
||||
.details-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user