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 note chat selection during live transcription (#1027)
Eren895520427fd5
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsxindex 92d420caf..f60f389d8 100644--- a/src/components/notes/NoteEditor.tsx+++ b/src/components/notes/NoteEditor.tsx@@ -1,4 +1,4 @@-import { useState, useRef, useEffect, useMemo, useCallback } from "react";+import { useState, useRef, useEffect, useMemo, useCallback, type ComponentProps } from "react";import { useTranslation } from "react-i18next";import {Download,@@ -21,7 +21,10 @@ import { SHARING_ENABLED } from "../../lib/features";import { RichTextEditor } from "../ui/RichTextEditor";import type { Editor } from "@tiptap/react";import { MeetingTranscriptChat, SelectionBar } from "./MeetingTranscriptChat";-import type { TranscriptSegment } from "../../stores/meetingRecordingStore";+import {+ useMeetingRecordingStore,+ type TranscriptSegment,+} from "../../stores/meetingRecordingStore";import {DropdownMenu,DropdownMenuTrigger,@@ -73,6 +76,76 @@ export interface Enhancement {type MeetingViewMode = "raw" | "transcript" | "enhanced";+type SpeakerProfileOption = { id?: number; display_name: string; email: string | null };++function buildKnownSpeakers(+ profiles: SpeakerProfileOption[],+ segments: TranscriptSegment[],+ mappings: Record<string, string>+): SpeakerProfileOption[] {+ const seen = new Set<string>();+ const list: SpeakerProfileOption[] = [];+ for (const p of profiles) {+ const key = p.display_name.toLowerCase();+ if (seen.has(key)) continue;+ seen.add(key);+ list.push(p);+ }+ for (const segment of segments) {+ if (!segment.speaker) continue;+ const name = mappings[segment.speaker] || segment.speakerName;+ if (!name) continue;+ const key = name.toLowerCase();+ if (seen.has(key)) continue;+ seen.add(key);+ list.push({ display_name: name, email: null });+ }+ return list;+}++type LiveMeetingTranscriptChatProps = Omit<+ ComponentProps<typeof MeetingTranscriptChat>,+ | "segments"+ | "micPartial"+ | "systemPartial"+ | "systemPartialSpeakerId"+ | "systemPartialSpeakerName"+ | "isRecording"+>;++// Subscribes to live transcript state at this leaf so per-update re-renders+// don't reach the editor/chat (which would drop text selection).+function LiveMeetingTranscriptChat({+ speakerProfiles,+ speakerMappings,+ ...props+}: LiveMeetingTranscriptChatProps) {+ const segments = useMeetingRecordingStore((s) => s.segments);+ const micPartial = useMeetingRecordingStore((s) => s.micPartial);+ const systemPartial = useMeetingRecordingStore((s) => s.systemPartial);+ const systemPartialSpeakerId = useMeetingRecordingStore((s) => s.systemPartialSpeakerId);+ const systemPartialSpeakerName = useMeetingRecordingStore((s) => s.systemPartialSpeakerName);++ const knownSpeakers = useMemo(+ () => buildKnownSpeakers(speakerProfiles ?? [], segments, speakerMappings ?? {}),+ [segments, speakerMappings, speakerProfiles]+ );++ return (+ <MeetingTranscriptChat+ {...props}+ isRecording+ segments={segments}+ micPartial={micPartial}+ systemPartial={systemPartial}+ systemPartialSpeakerId={systemPartialSpeakerId}+ systemPartialSpeakerName={systemPartialSpeakerName}+ speakerMappings={speakerMappings}+ speakerProfiles={knownSpeakers}+ />+ );+}+interface NoteEditorProps {note: NoteItem;onTitleChange: (title: string) => void;@@ -89,14 +162,7 @@ interface NoteEditorProps {actionProcessingState?: ActionProcessingState;actionName?: string | null;diarizationSessionId?: string | null;- meetingTranscript?: string;- meetingSegments?: TranscriptSegment[];- meetingMicPartial?: string;- meetingSystemPartial?: string;- meetingSystemPartialSpeakerId?: string | null;- meetingSystemPartialSpeakerName?: string | null;onLiveSpeakerLock?: (speakerId: string, displayName: string) => void;- liveTranscript?: string;sessionDiarizationEnabled?: boolean;sessionExpectedCount?: number;userTouchedStepper?: boolean;@@ -125,14 +191,7 @@ export default function NoteEditor({actionProcessingState,actionName,diarizationSessionId,- meetingTranscript,- meetingSegments,- meetingMicPartial,- meetingSystemPartial,- meetingSystemPartialSpeakerId,- meetingSystemPartialSpeakerName,onLiveSpeakerLock,- liveTranscript,sessionDiarizationEnabled,sessionExpectedCount,userTouchedStepper,@@ -180,8 +239,7 @@ export default function NoteEditor({return () => window.cancelAnimationFrame(frameId);}, []);- const effectiveTranscript = liveTranscript || meetingTranscript || note.transcript || "";- const hasMeetingTranscript = !isRecording && !!effectiveTranscript;+ const hasMeetingTranscript = !!note.transcript;const filteredFolders = useMemo(() =>@@ -192,11 +250,9 @@ export default function NoteEditor({);const displaySegments = useMemo<TranscriptSegment[]>(() => {- if (isRecording) return meetingSegments ?? [];if (diarizedSegments && diarizedSegments.length > 0) return diarizedSegments;- if (meetingSegments && meetingSegments.length > 0) return meetingSegments;return parseTranscriptSegments(note.transcript || "");- }, [diarizedSegments, isRecording, meetingSegments, note.transcript]);+ }, [diarizedSegments, note.transcript]);useEffect(() => {displaySegmentsRef.current = displaySegments;@@ -204,26 +260,10 @@ export default function NoteEditor({const hasChatSegments = displaySegments.length > 0;- const knownSpeakers = useMemo(() => {- const seen = new Set<string>();- const list: Array<{ id?: number; display_name: string; email: string | null }> = [];- for (const p of speakerProfiles) {- const key = p.display_name.toLowerCase();- if (seen.has(key)) continue;- seen.add(key);- list.push(p);- }- for (const segment of displaySegments) {- if (!segment.speaker) continue;- const name = speakerMappings[segment.speaker] || segment.speakerName;- if (!name) continue;- const key = name.toLowerCase();- if (seen.has(key)) continue;- seen.add(key);- list.push({ display_name: name, email: null });- }- return list;- }, [displaySegments, speakerMappings, speakerProfiles]);+ const knownSpeakers = useMemo(+ () => buildKnownSpeakers(speakerProfiles, displaySegments, speakerMappings),+ [displaySegments, speakerMappings, speakerProfiles]+ );const parsedParticipants = useMemo<CalendarAttendee[]>(() => {try {@@ -350,10 +390,14 @@ export default function NoteEditor({if (!data?.segments?.length) return;+ // Store segments outlive their recording — only use them for the note they belong to.+ const { recordingNoteId, segments: liveSegments } = useMeetingRecordingStore.getState();const persisted = await window.electronAPI?.getNote?.(note.id);const existing = persisted?.transcript? parseTranscriptSegments(persisted.transcript)- : displaySegmentsRef.current;+ : recordingNoteId === note.id && liveSegments.length > 0+ ? liveSegments+ : displaySegmentsRef.current;const enriched = mergeTranscriptSegments(existing,@@ -880,31 +924,44 @@ export default function NoteEditor({<div className="flex-1 relative min-h-0"><div className="h-full overflow-y-auto">{viewMode === "transcript" && (hasChatSegments || isRecording) ? (- <MeetingTranscriptChat- segments={displaySegments}- micPartial={isRecording ? meetingMicPartial : undefined}- systemPartial={isRecording ? meetingSystemPartial : undefined}- systemPartialSpeakerId={isRecording ? meetingSystemPartialSpeakerId : undefined}- systemPartialSpeakerName={isRecording ? meetingSystemPartialSpeakerName : undefined}- speakerMappings={speakerMappings}- speakerProfiles={knownSpeakers}- participants={parsedParticipants}- isRecording={isRecording}- isDiarizing={isDiarizing}- sessionDiarizationEnabled={sessionDiarizationEnabled}- sessionExpectedCount={sessionExpectedCount}- userTouchedStepper={userTouchedStepper}- onSetSessionDiarizationEnabled={onSetSessionDiarizationEnabled}- onSetSessionExpectedCount={onSetSessionExpectedCount}- onMapSpeaker={handleMapSpeaker}- onConfirmSuggestion={handleConfirmSuggestion}- onDismissSuggestion={handleDismissSuggestion}- onAttachSpeakerEmail={handleAttachSpeakerEmail}- selectedSegmentIds={!isRecording ? selectedSegmentIds : undefined}- onToggleSelect={!isRecording ? handleToggleSelect : undefined}- />+ isRecording ? (+ <LiveMeetingTranscriptChat+ speakerMappings={speakerMappings}+ speakerProfiles={speakerProfiles}+ participants={parsedParticipants}+ isDiarizing={isDiarizing}+ sessionDiarizationEnabled={sessionDiarizationEnabled}+ sessionExpectedCount={sessionExpectedCount}+ userTouchedStepper={userTouchedStepper}+ onSetSessionDiarizationEnabled={onSetSessionDiarizationEnabled}+ onSetSessionExpectedCount={onSetSessionExpectedCount}+ onMapSpeaker={handleMapSpeaker}+ onConfirmSuggestion={handleConfirmSuggestion}+ onDismissSuggestion={handleDismissSuggestion}+ onAttachSpeakerEmail={handleAttachSpeakerEmail}+ />+ ) : (+ <MeetingTranscriptChat+ segments={displaySegments}+ speakerMappings={speakerMappings}+ speakerProfiles={knownSpeakers}+ participants={parsedParticipants}+ isDiarizing={isDiarizing}+ sessionDiarizationEnabled={sessionDiarizationEnabled}+ sessionExpectedCount={sessionExpectedCount}+ userTouchedStepper={userTouchedStepper}+ onSetSessionDiarizationEnabled={onSetSessionDiarizationEnabled}+ onSetSessionExpectedCount={onSetSessionExpectedCount}+ onMapSpeaker={handleMapSpeaker}+ onConfirmSuggestion={handleConfirmSuggestion}+ onDismissSuggestion={handleDismissSuggestion}+ onAttachSpeakerEmail={handleAttachSpeakerEmail}+ selectedSegmentIds={selectedSegmentIds}+ onToggleSelect={handleToggleSelect}+ />+ )) : viewMode === "transcript" && hasMeetingTranscript ? (- <RichTextEditor value={effectiveTranscript} disabled />+ <RichTextEditor value={note.transcript || ""} disabled />) : viewMode === "enhanced" && enhancement ? (<RichTextEditor value={enhancement.content} onChange={handleEnhancedChange} />) : (diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex c02e549bc..35196d3c0 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -152,17 +152,11 @@ export default function PersonalNotesView({const { isComplete: isOnboardingComplete, complete: completeOnboarding } = useNotesOnboarding();const isTranscribing = useMeetingRecordingStore((s) => s.isRecording);- const realtimeTranscript = useMeetingRecordingStore((s) => s.transcript);- const realtimeSegments = useMeetingRecordingStore((s) => s.segments);- const micPartial = useMeetingRecordingStore((s) => s.micPartial);- const systemPartial = useMeetingRecordingStore((s) => s.systemPartial);- const systemPartialSpeakerId = useMeetingRecordingStore((s) => s.systemPartialSpeakerId);- const systemPartialSpeakerName = useMeetingRecordingStore((s) => s.systemPartialSpeakerName);const diarizationSessionId = useMeetingRecordingStore((s) => s.diarizationSessionId);+ const recordingNoteId = useMeetingRecordingStore((s) => s.recordingNoteId);const sessionDiarizationEnabled = useMeetingRecordingStore((s) => s.sessionDiarizationEnabled);const sessionExpectedCount = useMeetingRecordingStore((s) => s.sessionExpectedCount);const userTouchedStepper = useMeetingRecordingStore((s) => s.userTouchedStepper);- const recordingNoteId = useMeetingRecordingStore((s) => s.recordingNoteId);const {folders,@@ -482,9 +476,11 @@ export default function PersonalNotesView({runAction,} = useActionProcessing(activeNoteId ?? null);- // The realtime transcript outlives its recording — only use it for the note it was recorded on.- const activeNoteRawTranscript =- (recordingNoteId === activeNote?.id ? realtimeTranscript : "") || activeNote?.transcript || "";+ // Boolean flag so actions enable during recording without re-rendering on every transcript update.+ const hasLiveTranscript = useMeetingRecordingStore(+ (s) => s.recordingNoteId === activeNote?.id && !!s.transcript+ );+ const activeNoteRawTranscript = activeNote?.transcript || "";const isEnhancementStale = useMemo(() => {if (!activeNote?.enhanced_content || !activeNote?.enhanced_at_content_hash) return false;@@ -531,11 +527,9 @@ export default function PersonalNotesView({const prevTranscribingRef = useRef(false);useEffect(() => {- if (- prevTranscribingRef.current &&- !isTranscribing &&- (realtimeTranscript || realtimeSegments.length > 0)- ) {+ if (prevTranscribingRef.current && !isTranscribing) {+ const { transcript: realtimeTranscript, segments: realtimeSegments } =+ useMeetingRecordingStore.getState();const transcript =realtimeSegments.length > 0? serializeTranscriptSegments(realtimeSegments)@@ -546,20 +540,22 @@ export default function PersonalNotesView({}}prevTranscribingRef.current = isTranscribing;- }, [isTranscribing, realtimeTranscript, realtimeSegments, recordingNoteId]);+ }, [isTranscribing, recordingNoteId]);useEffect(() => {if (!isTranscribing) return;const interval = setInterval(() => {- if (!recordingNoteId || realtimeSegments.length === 0) return;- window.electronAPI.updateNote(recordingNoteId, {+ const { recordingNoteId: currentRecordingNoteId, segments: realtimeSegments } =+ useMeetingRecordingStore.getState();+ if (!currentRecordingNoteId || realtimeSegments.length === 0) return;+ window.electronAPI.updateNote(currentRecordingNoteId, {transcript: serializeTranscriptSegments(realtimeSegments),});}, 30_000);return () => clearInterval(interval);- }, [isTranscribing, realtimeSegments, recordingNoteId]);+ }, [isTranscribing]);const isLocalSynced = syncedNoteId === activeNote?.id;const isActiveNoteRecording = isTranscribing && recordingNoteId === activeNote?.id;@@ -954,18 +950,7 @@ export default function PersonalNotesView({: undefined}diarizationSessionId={diarizationSessionId}- meetingTranscript={isActiveNoteRecording ? realtimeTranscript : ""}- meetingSegments={isActiveNoteRecording ? realtimeSegments : []}- meetingMicPartial={isActiveNoteRecording ? micPartial : ""}- meetingSystemPartial={isActiveNoteRecording ? systemPartial : ""}- meetingSystemPartialSpeakerId={- isActiveNoteRecording ? systemPartialSpeakerId : undefined- }- meetingSystemPartialSpeakerName={- isActiveNoteRecording ? systemPartialSpeakerName : undefined- }onLiveSpeakerLock={lockSpeaker}- liveTranscript={isActiveNoteRecording ? realtimeTranscript : ""}sessionDiarizationEnabled={sessionDiarizationEnabled}sessionExpectedCount={sessionExpectedCount}userTouchedStepper={userTouchedStepper}@@ -982,14 +967,19 @@ export default function PersonalNotesView({<ActionPickeronRunAction={(action) => {if (!editorNote) return;+ const { recordingNoteId: liveNoteId, transcript: liveTranscript } =+ useMeetingRecordingStore.getState();+ const rawTranscript =+ (liveNoteId === activeNote?.id ? liveTranscript : "") ||+ activeNoteRawTranscript;const noteContent = editorNote.content;const hasNotes = !!noteContent.trim();- if (!hasNotes && !activeNoteRawTranscript) return;+ if (!hasNotes && !rawTranscript) return;let formattedTranscript = "";let isMeetingNote = false;- if (activeNoteRawTranscript) {- const segments = parseTranscriptSegments(activeNoteRawTranscript);+ if (rawTranscript) {+ const segments = parseTranscriptSegments(rawTranscript);if (segments.length > 0) {isMeetingNote = true;formattedTranscript = segments@@ -1000,7 +990,7 @@ export default function PersonalNotesView({.join("\n");}if (!formattedTranscript) {- formattedTranscript = activeNoteRawTranscript;+ formattedTranscript = rawTranscript;}}@@ -1010,31 +1000,26 @@ export default function PersonalNotesView({].filter(Boolean).join("\n\n");- runAction(- action,- parts,- makeContentHash(`${noteContent}\n${activeNoteRawTranscript}`),- {- isCloudMode,- modelId: effectiveModelId,- isMeetingNote,- allowTitleGeneration: isRegenerableNoteTitle(- editorNote.title,- [- t("notes.list.untitledNote"),- t("notes.list.newNote"),- t("notes.sidebar.newNote"),- ],- calendarEventName- ),- }- );+ runAction(action, parts, makeContentHash(`${noteContent}\n${rawTranscript}`), {+ isCloudMode,+ modelId: effectiveModelId,+ isMeetingNote,+ allowTitleGeneration: isRegenerableNoteTitle(+ editorNote.title,+ [+ t("notes.list.untitledNote"),+ t("notes.list.newNote"),+ t("notes.sidebar.newNote"),+ ],+ calendarEventName+ ),+ });}}onManageActions={() => setShowActionManager(true)}disabled={(!editorNote?.content?.trim() &&- !realtimeTranscript &&- !activeNote?.transcript) ||+ !hasLiveTranscript &&+ !activeNoteRawTranscript) ||actionProcessingState === "processing"}/>