Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: Reconciliation deleted a manual mapping whenever the live and offline speaker ids matched
Chadpiha7e13884ffc68
diff --git a/src/helpers/liveSpeakerIdentifier.js b/src/helpers/liveSpeakerIdentifier.jsindex 095498645..9252b1141 100644--- a/src/helpers/liveSpeakerIdentifier.js+++ b/src/helpers/liveSpeakerIdentifier.js@@ -710,12 +710,24 @@ class LiveSpeakerIdentifier {const matchedProfile = this._findStoredProfileMatch(embedding);if (matchedProfile) {speakerId = this._findTransientSpeakerForProfile(matchedProfile.id);+ let forced = false;if (!speakerId) {- speakerId = this._assignOrForceCluster(embedding);+ ({ speakerId, forced } = this._assignOrForceCluster(embedding));} else if (updateCentroid) {this._updateCentroid(speakerId, embedding);}+ // A forced at-cap fold lands on someone else's cluster — retagging it+ // with the overflow speaker's profile would erase the original identity+ // and keep capturing this voice via the profile lookup even after the+ // cap rises.+ if (forced) {+ return {+ speakerId,+ displayName: this.transientDisplayNames.get(speakerId) || null,+ };+ }+this.transientProfileIds.set(speakerId, matchedProfile.id);this.transientDisplayNames.set(speakerId, matchedProfile.display_name);return {@@ -724,9 +736,13 @@ class LiveSpeakerIdentifier {};}- speakerId = this.currentSegmentSpeakerId || this._assignOrForceCluster(embedding);- if (updateCentroid && this.currentSegmentSpeakerId) {- this._updateCentroid(speakerId, embedding);+ speakerId = this.currentSegmentSpeakerId;+ if (speakerId) {+ if (updateCentroid) {+ this._updateCentroid(speakerId, embedding);+ }+ } else {+ ({ speakerId } = this._assignOrForceCluster(embedding));}return {@@ -743,10 +759,10 @@ class LiveSpeakerIdentifier {// overflow is usually a different voice, and a polluted centroid would// keep capturing it even after the cap rises (participants added// mid-meeting).- return nearest;+ return { speakerId: nearest, forced: true };}}- return this._assignSpeakerId(embedding);+ return { speakerId: this._assignSpeakerId(embedding), forced: false };}_findNearestTransient(embedding) {diff --git a/test/helpers/liveSpeakerIdentifier.test.js b/test/helpers/liveSpeakerIdentifier.test.jsindex 4a0b49c6b..58822eb44 100644--- a/test/helpers/liveSpeakerIdentifier.test.js+++ b/test/helpers/liveSpeakerIdentifier.test.js@@ -204,6 +204,35 @@ test("a voice force-merged at the cap becomes its own speaker once the cap rises);});+test("an at-cap fold never steals the cluster's identity for a profile-matched voice", () => {+ const { LiveSpeakerIdentifier } = loadIdentifier();+ const identifier = new LiveSpeakerIdentifier();+ identifier.setMaxSpeakers(1);+ identifier.getSpeakerProfiles = () => [+ { id: 1, display_name: "Alice", embedding: voiceA },+ { id: 2, display_name: "Bob", embedding: voiceB },+ ];++ const alice = identifier._resolveSpeakerForEmbedding(voiceA, { updateCentroid: true });+ assert.equal(alice.displayName, "Alice");++ // Bob overflows the cap: his utterance is folded into Alice's cluster, but+ // the cluster must keep Alice's identity — retagging it as Bob would both+ // mislabel Alice and re-capture Bob through the profile lookup later.+ const bobAtCap = identifier._resolveSpeakerForEmbedding(voiceB, { updateCentroid: true });+ assert.equal(bobAtCap.speakerId, alice.speakerId);+ assert.equal(bobAtCap.displayName, "Alice");++ identifier.setMaxSpeakers(3);+ const bobAfter = identifier._resolveSpeakerForEmbedding(voiceB, { updateCentroid: true });+ assert.notEqual(bobAfter.speakerId, alice.speakerId, "Bob must get his own cluster");+ assert.equal(bobAfter.displayName, "Bob");++ const aliceAgain = identifier._resolveSpeakerForEmbedding(voiceA, { updateCentroid: true });+ assert.equal(aliceAgain.speakerId, alice.speakerId);+ assert.equal(aliceAgain.displayName, "Alice", "Alice's cluster must still be hers");+});+test("distinct voices are folded into one cluster when the session cap is 1", () => {const { LiveSpeakerIdentifier } = loadIdentifier();const identifier = new LiveSpeakerIdentifier();