Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Saving earlier meetings ends on Earlier meetings saved, even when the last progress update arrives after the save's reply
christianmatc1644465f9f8
diff --git a/app/src/renderer/src/autoExportProgress.ts b/app/src/renderer/src/autoExportProgress.tsnew file mode 100644index 00000000..e7d8c9ee--- /dev/null+++ b/app/src/renderer/src/autoExportProgress.ts@@ -0,0 +1,12 @@+/** "Also save your earlier meetings?": how far along, or 'done' (null: nothing to show) */+export type Earlier = { done: number; total: number } | 'done' | null++/**+ * Main's progress events and the save's reply come on different channels, which Electron doesn't keep in order:+ * a last "2 of 2" can land after the reply. Progress only moves a save that is still going, so it never undoes the end.+ */+export function earlierStep(s: Earlier, e: { start: true } | { progress: { done: number; total: number } } | { finished: boolean }): Earlier {+ if ('start' in e) return { done: 0, total: 0 }+ if ('progress' in e) return s && s !== 'done' ? e.progress : s+ return e.finished ? 'done' : null+}diff --git a/app/src/renderer/src/screens/Settings.tsx b/app/src/renderer/src/screens/Settings.tsxindex 4b879973..2a55f344 100644--- a/app/src/renderer/src/screens/Settings.tsx+++ b/app/src/renderer/src/screens/Settings.tsx@@ -18,6 +18,7 @@ import { CalendarSettings } from '../components/CalendarSettings'import { PhoneSettings } from '../components/PhoneSettings'import { supportedKinds, settingsPage } from '../../../shared/platform'import { Swap, SwapText } from '../components/Swap'+import { earlierStep, type Earlier } from '../autoExportProgress'export function NextMeetingSetting({ visible, on, onChange }: { visible: boolean; on: boolean; onChange(on: boolean): void }) {if (!visible) return null@@ -482,8 +483,6 @@ function Backup({ onImported }: { onImported(): void }) {)}-type Earlier = { done: number; total: number } | 'done' | null-/** a copy of each meeting in a folder of the person's (Obsidian, Dropbox, Google Drive), kept up to date by main */function AutoExport() {const [s, setS] = useState<AutoExportState>()@@ -492,7 +491,7 @@ function AutoExport() {useEffect(() => {void window.yogurt.autoExport.get().then(setS)const offState = window.yogurt.autoExport.onState(setS)- const offProgress = window.yogurt.autoExport.onProgress(setEarlier)+ const offProgress = window.yogurt.autoExport.onProgress((progress) => setEarlier((s) => earlierStep(s, { progress })))return () => { offState(); offProgress() }}, [])const act = async (f: () => Promise<AutoExportState>) => {@@ -501,9 +500,9 @@ function AutoExport() {}const answer = async (save: boolean) => {setS((p) => p && { ...p, offerEarlier: false })- if (save) setEarlier({ done: 0, total: 0 })+ if (save) setEarlier((s) => earlierStep(s, { start: true }))const r = await window.yogurt.autoExport.earlier(save).catch(() => ({ saved: 0, failed: true }))- setEarlier(save && !r.failed ? 'done' : null)+ setEarlier((s) => earlierStep(s, { finished: save && !r.failed }))}const label = t('Save a copy of each meeting to a folder')return (diff --git a/app/test/autoExportProgress.test.ts b/app/test/autoExportProgress.test.tsnew file mode 100644index 00000000..a4e5b72e--- /dev/null+++ b/app/test/autoExportProgress.test.ts@@ -0,0 +1,17 @@+import { expect, it } from 'vitest'+import { earlierStep } from '../src/renderer/src/autoExportProgress'++it('a progress update arriving after the save finished does not undo "saved"', () => {+ // invoke's reply and webContents.send events are not ordered against each other+ let s = earlierStep(null, { start: true })+ s = earlierStep(s, { progress: { done: 1, total: 2 } })+ s = earlierStep(s, { finished: true })+ s = earlierStep(s, { progress: { done: 2, total: 2 } })+ expect(s).toBe('done')+})++it('shows progress while saving, and nothing once it failed or was never started', () => {+ expect(earlierStep(earlierStep(null, { start: true }), { progress: { done: 1, total: 3 } })).toEqual({ done: 1, total: 3 })+ expect(earlierStep(null, { progress: { done: 1, total: 3 } })).toBeNull()+ expect(earlierStep({ done: 1, total: 3 }, { finished: false })).toBeNull()+})