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
recorder hover reads only the latest 80 lines and stays that size however long the meeting runs
Eric Brownrout4725ad7eb924
diff --git a/app/src/main/index.ts b/app/src/main/index.tsindex e7b3aaeb..01a1967b 100644--- a/app/src/main/index.ts+++ b/app/src/main/index.ts@@ -513,7 +513,9 @@ app.whenReady().then(() => {ipcMain.handle('transcript:get', (_e, id: unknown, o: unknown) => {if (!isId(id)) return []const order = store.speakerOrder(id)- return store.segments(id, { hidden: !!(o && typeof o === 'object' && (o as { hidden?: unknown }).hidden === true) })+ const opts = (o && typeof o === 'object' ? o : {}) as { hidden?: unknown; last?: unknown }+ const last = Number.isInteger(opts.last) && (opts.last as number) > 0 ? Math.min(opts.last as number, 1000) : undefined+ return store.segments(id, { hidden: opts.hidden === true, last }).map(s => ({ ...s, speakerColor: speakerColor(s.track, s.speaker, order) }))})// Replay through the live channel so a stale async reply cannot overtake newer words or finals.diff --git a/app/src/main/store.ts b/app/src/main/store.tsindex 26c5ff40..39823eca 100644--- a/app/src/main/store.ts+++ b/app/src/main/store.ts@@ -357,9 +357,11 @@ export class Store {} catch (e) { this.db.exec('ROLLBACK'); throw e }}/** the meeting's lines in order; hidden echo lines left out unless asked for */- segments(meetingId: string, o: { hidden?: boolean } = {}): Segment[] {- const sql = o.hidden ? 'SELECT * FROM segments WHERE meeting_id = ? ORDER BY start_ms, id' : 'SELECT * FROM segments WHERE meeting_id = ? AND hidden = 0 ORDER BY start_ms, id'- return (this.db.prepare(sql).all(meetingId) as Row[]).map(toSegment)+ /** last: only the latest lines (the recorder's hover reads a recent tail, however long the meeting runs) */+ segments(meetingId: string, o: { hidden?: boolean; last?: number } = {}): Segment[] {+ const where = o.hidden ? 'meeting_id = ?' : 'meeting_id = ? AND hidden = 0'+ if (o.last) return (this.db.prepare(`SELECT * FROM (SELECT * FROM segments WHERE ${where} ORDER BY start_ms DESC, id DESC LIMIT ?) ORDER BY start_ms, id`).all(meetingId, o.last) as Row[]).map(toSegment)+ return (this.db.prepare(`SELECT * FROM segments WHERE ${where} ORDER BY start_ms, id`).all(meetingId) as Row[]).map(toSegment)}/** Full saved history establishes legacy colours; new names append even after late attribution. */speakerOrder(meetingId: string, arriving?: string | null): string[] {diff --git a/app/src/renderer/src/windows/Widget.tsx b/app/src/renderer/src/windows/Widget.tsxindex e33dd1a3..fd592de9 100644--- a/app/src/renderer/src/windows/Widget.tsx+++ b/app/src/renderer/src/windows/Widget.tsx@@ -154,6 +154,8 @@ export function WidgetPreview() {return recording ? <Preview key={view.meetingId} view={view} cardRef={card} /> : null}+const RECENT_LINES = 80+function Preview({ view, cardRef }: { view: WidgetView; cardRef: React.RefObject<HTMLDivElement | null> }) {const [lines, setLines] = useState<Array<Omit<Segment, 'id'>>>([])const [parts, setParts] = useState<Record<string, TranscriptPartial>>({})@@ -164,23 +166,23 @@ function Preview({ view, cardRef }: { view: WidgetView; cardRef: React.RefObjectconst stick = useRef(true)const gliding = useRef<(() => void) | null>(null)const [behind, setBehind] = useState(false)+ // Older lines leave as new ones arrive, so a long meeting stays as light as a short one; not while scrolled up to read.+ const recentOnly = (l: Array<Omit<Segment, 'id'>>) => stick.current && l.length > RECENT_LINES ? l.slice(-RECENT_LINES) : luseEffect(() => {let alive = true- const refresh = () => { void window.yogurt.transcript.get(view.meetingId, { hidden: true }).then((saved) => {+ // A hover shows recent context, read as a tail; the full transcript stays in the meeting.+ const refresh = () => { void window.yogurt.transcript.get(view.meetingId, { hidden: true, last: RECENT_LINES }).then((recent) => {if (!alive) return- // A hover shows recent context; the full transcript stays in the meeting.- const recent = saved.slice(-80)- const known = new Map(saved.map(s => [`${s.track}:${s.startMs}`, s]))setLines(current => {- const merged = new Map(current.map(s => [`${s.track}:${s.startMs}`, known.get(`${s.track}:${s.startMs}`) ?? s]))+ const merged = new Map(current.map(s => [`${s.track}:${s.startMs}`, s]))for (const s of recent) merged.set(`${s.track}:${s.startMs}`, s)- return [...merged.values()].filter(s => !s.hidden).sort((a, b) => a.startMs - b.startMs)+ return recentOnly([...merged.values()].filter(s => !s.hidden).sort((a, b) => a.startMs - b.startMs))})setLoaded(true); setFailed(false)}, () => { if (alive) { setLoaded(true); setFailed(true) } }) }const offSegment = window.yogurt.transcript.onSegment((s) => {if (s.meetingId !== view.meetingId) return- setLines(current => [...current.filter(l => l.track !== s.track || l.startMs !== s.startMs), s].filter(l => !l.hidden).sort((a, b) => a.startMs - b.startMs))+ setLines(current => recentOnly([...current.filter(l => l.track !== s.track || l.startMs !== s.startMs), s].filter(l => !l.hidden).sort((a, b) => a.startMs - b.startMs)))setParts(current => {const had = current[s.track]if (!had) return currentdiff --git a/app/src/shared/types.ts b/app/src/shared/types.tsindex ce7721e9..b910fe58 100644--- a/app/src/shared/types.ts+++ b/app/src/shared/types.ts@@ -96,8 +96,8 @@ export type YogurtApi = {}/** the words heard in a meeting, live */transcript: {- /** the meeting's lines; hidden: the echo lines hidden after the meeting too (each marked hidden) */- get(meetingId: string, o?: { hidden?: boolean }): Promise<Segment[]>+ /** the meeting's lines; hidden: the echo lines hidden after the meeting too (each marked hidden); last: only the latest lines */+ get(meetingId: string, o?: { hidden?: boolean; last?: number }): Promise<Segment[]>/** brings hidden lines back: the ones given, or all of the meeting's */restore(meetingId: string, ids?: number[]): Promise<void>/** each line as it is saved (a me line a couple of seconds after it was said); returns the way to stop listening */diff --git a/app/test/store.test.ts b/app/test/store.test.tsindex 7161329e..595ecf1c 100644--- a/app/test/store.test.ts+++ b/app/test/store.test.ts@@ -47,6 +47,15 @@ describe('store', () => {expect(segs[0].id).toBeTypeOf('number')})+ it('reads only the latest lines when asked for a tail, still in time order', () => {+ const s = fresh()+ const m = s.createMeeting({ ...base, startedAt: 1 })+ s.addSegments(Array.from({ length: 200 }, (_, i) => ({ meetingId: m.id, track: i % 2 ? 'them' as const : 'me' as const, startMs: i * 1000, endMs: i * 1000 + 900, text: `line ${i}`, speaker: null, hidden: i === 198 })))+ expect(s.segments(m.id, { last: 3 }).map(x => x.text)).toEqual(['line 196', 'line 197', 'line 199'])+ expect(s.segments(m.id, { hidden: true, last: 3 }).map(x => x.text)).toEqual(['line 197', 'line 198', 'line 199'])+ expect(s.segments(m.id)).toHaveLength(199)+ })+it('sets the speaker of given lines and leaves the others alone', () => {const s = fresh()const m = s.createMeeting({ ...base, startedAt: 1 })