Skip to content

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.

log whether a long meeting's notes or answer builds on what was read ahead, and where it parts (counts only)

christianmat3451f23c306e
diff --git a/app/src/main/notes/model.ts b/app/src/main/notes/model.ts
index 6684d115..11dbe4cf 100644
--- a/app/src/main/notes/model.ts
+++ b/app/src/main/notes/model.ts
@@ -3,6 +3,19 @@ import { GraphicsGaveUpError, type Engine } from '../engine'
import type { Llm } from './enhance'
import { readInSteps } from './readAhead'
+/**
+ * How much of what the model holds a new prompt still starts with, for the log: a long meeting's notes start within
+ * seconds only when the prompt extends what was read ahead. Counts only, never the text.
+ */
+export function heldMatch(held: string, prompt: string): string {
+ if (!held) return 'nothing read ahead (or something else used the model since)'
+ let same = 0
+ while (same < held.length && same < prompt.length && held[same] === prompt[same]) same++
+ if (same === held.length) return `reuses all ${held.length.toLocaleString('en-US')} chars read ahead`
+ const line = prompt.slice(0, same).split('\n').length
+ return `differs from what was read ahead at char ${same.toLocaleString('en-US')} of ${held.length.toLocaleString('en-US')} (line ${line}): read again from there`
+}
+
/** an earlier prompt and answer, as the conversation they were */
const before = (pairs: string[] = []): EngineMessage[] => pairs.map((content, i) => ({ role: i % 2 ? 'assistant' : 'user', content }))
@@ -47,6 +60,8 @@ export function createNotesModel(o: { engine: Engine; modelPath: () => string |
count: (texts) => o.engine.count(texts),
chat: (prompt, onToken, opts) => {
const messages: EngineMessage[] = [...before(opts?.before), { role: 'user', content: prompt }]
+ // only for a prompt long enough to be worth reading ahead: a meeting's notes or a question about one
+ if (prompt.length > 20_000) console.info('NOTES', `prompt ${heldMatch(held, prompt)}`)
// not known while it runs; the worker skips what it already holds, so knowing less only costs a check
held = ''
let wrote = false
diff --git a/app/test/heldMatch.test.ts b/app/test/heldMatch.test.ts
new file mode 100644
index 00000000..5a404728
--- /dev/null
+++ b/app/test/heldMatch.test.ts
@@ -0,0 +1,10 @@
+import { expect, it } from 'vitest'
+import { heldMatch } from '../src/main/notes/model'
+
+it('says whether a prompt builds on what was read ahead, where it parts, and never the text itself', () => {
+ expect(heldMatch('', 'anything')).toMatch(/nothing read ahead/)
+ expect(heldMatch('Here is the transcript\nYou: hi', 'Here is the transcript\nYou: hi\nThem: hello')).toBe('reuses all 30 chars read ahead')
+ const msg = heldMatch('Here is the transcript\nYou: hi there', 'Here is the transcript\nDana: hi there')
+ expect(msg).toBe('differs from what was read ahead at char 23 of 36 (line 2): read again from there')
+ expect(msg).not.toContain('hi there')
+})