Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(notes): keep diarized mic speakers distinct in the LLM transcript (#2719)

Chad Piha9c30bfe35631
diff --git a/src/utils/llmTranscript.ts b/src/utils/llmTranscript.ts
index 10b021faa..626fdfcb9 100644
--- a/src/utils/llmTranscript.ts
+++ b/src/utils/llmTranscript.ts
@@ -15,8 +15,11 @@ const isSelfParticipant = (participant: CalendarAttendee, identity: MeetingIdent
participant.self || (!!identity.selfEmail && participant.email === identity.selfEmail);
/**
- * Speaker label for the LLM payload. An unnamed mic track falls back to the
- * note owner's real name instead of an anonymous "You" whenever it is known.
+ * Speaker label for the LLM payload. An unnamed, unnumbered mic track falls back
+ * to the note owner's real name instead of an anonymous "You" whenever it is known.
+ * Diarization numbers the mic's clusters when several people share it (an
+ * in-person meeting), so a numbered mic segment is someone in the room, not
+ * necessarily the owner — matching the "Speaker N" the transcript view shows.
*/
export function resolveLlmSpeakerLabel(
segment: TranscriptSegment,
@@ -30,11 +33,12 @@ export function resolveLlmSpeakerLabel(
? selfLabel
: resolved;
}
- if (segment.source === "mic" || segment.speaker === "you") return selfLabel;
+ if (segment.speaker === "you") return selfLabel;
if (segment.speaker) {
const num = Number.parseInt(segment.speaker.replace("speaker_", ""), 10);
if (!Number.isNaN(num)) return t("notes.speaker.label", { n: num + 1 });
}
+ if (segment.source === "mic") return selfLabel;
return t("notes.speaker.them");
}
diff --git a/test/utils/llmTranscript.test.js b/test/utils/llmTranscript.test.js
index 54c0693a3..3b0870682 100644
--- a/test/utils/llmTranscript.test.js
+++ b/test/utils/llmTranscript.test.js
@@ -69,13 +69,39 @@ test("a renamed microphone cluster reaches note generation without per-segment n
buildLlmTranscript([segment], { speaker_0: "Ravi Patel" }, "Casey", t),
"Ravi Patel: I will send the proposal."
);
- assert.equal(buildLlmTranscript([segment], {}, "Casey", t), "Casey: I will send the proposal.");
+ assert.equal(
+ buildLlmTranscript([segment], {}, "Casey", t),
+ "Speaker 1: I will send the proposal."
+ );
assert.equal(
buildLlmTranscript([segment], { speaker_0: " you " }, "Casey", t),
"Casey: I will send the proposal."
);
});
+test("an in-person meeting's diarized mic clusters keep their speaker numbers", async () => {
+ const { buildLlmTranscript, resolveLlmSpeakerLabel } = await load();
+ const segments = [
+ { source: "mic", speaker: "speaker_0", text: "Can you send the proposal?" },
+ { source: "mic", speaker: "speaker_1", text: "I will send it today." },
+ { source: "mic", speaker: "you", text: "Thanks." },
+ { source: "mic", text: "Before diarization." },
+ ];
+ assert.equal(
+ buildLlmTranscript(segments, {}, "Casey", t),
+ [
+ "Speaker 1: Can you send the proposal?",
+ "Speaker 2: I will send it today.",
+ "Casey: Thanks.",
+ "Casey: Before diarization.",
+ ].join("\n")
+ );
+ assert.equal(
+ resolveLlmSpeakerLabel(segments[1], { speaker_1: "Ravi Patel" }, "Casey", t),
+ "Ravi Patel"
+ );
+});
+
test("system segments resolve name → mapping → Speaker N → Them", async () => {
const { resolveLlmSpeakerLabel } = await load();
const locked = {