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.

Ask: one question from another app, answered across meetings with its sources, without keeping a conversation

christianmatb50647fd25e7
diff --git a/app/src/main/library/conversations.ts b/app/src/main/library/conversations.ts
index a888d1ee..c617dd6f 100644
--- a/app/src/main/library/conversations.ts
+++ b/app/src/main/library/conversations.ts
@@ -256,6 +256,28 @@ export function hookConversations(p: Deps) {
p.library.deleteConversation(id)
p.sendList(list())
},
+ /**
+ * One question from another app (MCP): answered the same way, then the conversation goes, so Ask's list keeps
+ * only the person's own. It never waits for a download or a recording to end: it says so instead. A long answer
+ * is stopped after timeoutMs, with what was written.
+ */
+ async askOnce(question: string, chips: import('../../shared/askContext').ContextChip[], o: { timeoutMs?: number } = {}):
+ Promise<{ unavailable: 'model' | 'recording' } | { answer: string; sources: LibrarySource[]; stopped?: true }> {
+ if (p.waitsForModel()) return { unavailable: 'model' }
+ if (p.waitsForMeeting()) return { unavailable: 'recording' }
+ const cid = p.library.current(chips, true)
+ try {
+ const { done } = ask(cid, question)
+ let timer: NodeJS.Timeout | undefined
+ await Promise.race([done, new Promise<void>((r) => { timer = setTimeout(() => { running.get(cid)?.abort(); r() }, o.timeoutMs ?? 120_000) })])
+ clearTimeout(timer)
+ await done
+ const turn = turns(cid).at(-1)
+ if (!turn || turn.status === 'failed') throw new Error('The answer failed')
+ const cited = new Set(citedIn(turn.answer))
+ return { answer: turn.answer, sources: turn.sources.filter((s) => cited.has(s.n)), ...(turn.status === 'stopped' ? { stopped: true as const } : {}) }
+ } finally { api.remove(cid) }
+ },
/** Imports may bring waiting questions too; open conversations hear when the model arrives. */
refresh() { recover(); for (const id of open.keys()) push(id) },
}
diff --git a/app/test/libraryChat.test.ts b/app/test/libraryChat.test.ts
index a467afe3..43bc4ef1 100644
--- a/app/test/libraryChat.test.ts
+++ b/app/test/libraryChat.test.ts
@@ -372,3 +372,30 @@ describe('questions waiting for the first notes download', () => {
expect(t.prompts).toEqual([])
})
})
+
+describe('one question from another app (askOnce)', () => {
+ it('answers across meetings with the sources it cites, and keeps no conversation in Ask', async () => {
+ const t = await rig()
+ const got = await t.chats.askOnce('What did Tarun say about the price?', [])
+ expect(got).toEqual({ answer: 'It is **twenty dollars** a seat [1].', sources: [expect.objectContaining({ n: 1, meetingId: t.meeting.id, title: 'Pricing call', atMs: 724_000 })] })
+ expect(t.chats.list()).toEqual([])
+ expect(t.library.conversations()).toEqual([])
+ })
+ it('reads only the meetings it is given', async () => {
+ const t = await rig()
+ const folder = t.store.createFolder('Project')
+ await t.chats.askOnce('What was decided?', [{ kind: 'folder', id: folder.id }])
+ expect(t.prompts[0]).not.toContain('Twenty dollars a seat')
+ })
+ it('says the notes model is not ready instead of waiting for it', async () => {
+ const t = await rig({ waitsForModel: () => true })
+ expect(await t.chats.askOnce('What did Tarun say?', [])).toEqual({ unavailable: 'model' })
+ expect(t.prompts).toEqual([])
+ expect(t.library.conversations()).toEqual([])
+ })
+ it('stops an answer that takes too long and gives what was written', async () => {
+ const t = await rig({ llm: { chat: (_p, onToken) => new Promise(() => { onToken('Twenty ') }) } })
+ const got = await t.chats.askOnce('What did Tarun say?', [], { timeoutMs: 50 })
+ expect(got).toMatchObject({ answer: 'Twenty', stopped: true })
+ })
+})