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
Ask keeps focus in the box after sending and through the answer; Back to latest floats 8px above the box
christianmatb02876dd153d
diff --git a/app/e2e/askFocus.spec.ts b/app/e2e/askFocus.spec.tsnew file mode 100644index 00000000..51f87e9d--- /dev/null+++ b/app/e2e/askFocus.spec.ts@@ -0,0 +1,94 @@+import { _electron as electron, expect, test, type Locator, type Page } from '@playwright/test'+import { mkdtempSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'++const main = join(import.meta.dirname, '../out/main/index.js')+const focused = (input: Locator) => input.evaluate(el => document.activeElement === el)++// Sending must leave the person in the box: they keep typing through the whole answer.+async function keepsFocus(page: Page, prefix: string) {+ const input = page.getByTestId(`${prefix}-input`)+ await expect(input).toBeFocused()+ await input.pressSequentially('What was decided?')+ await input.press('Enter')+ const turn = page.getByTestId(`${prefix}-turn`).last()+ await expect(turn).toHaveAttribute('data-status', 'answering', { timeout: 10_000 })+ await expect(page.getByTestId(`${prefix}-input`)).toBeFocused()+ await page.keyboard.type('And next')+ await expect(page.getByTestId(`${prefix}-input`)).toHaveValue('And next')+ await expect(turn).toHaveAttribute('data-status', 'done', { timeout: 15_000 })+ expect(await focused(page.getByTestId(`${prefix}-input`))).toBe(true)+ await page.keyboard.type(' steps?')+ await expect(page.getByTestId(`${prefix}-input`)).toHaveValue('And next steps?')+ // A send from the button comes back to the box too, once the stop button takes its place.+ await page.getByTestId(`${prefix}-send`).click()+ await expect(page.getByTestId(`${prefix}-turn`).last()).toHaveAttribute('data-status', 'answering', { timeout: 10_000 })+ await expect(page.getByTestId(`${prefix}-input`)).toBeFocused()+ await expect(page.getByTestId(`${prefix}-turn`).last()).toHaveAttribute('data-status', 'done', { timeout: 15_000 })+ await expect(page.getByTestId(`${prefix}-input`)).toBeFocused()+ // A deliberate click elsewhere keeps its focus.+ await page.getByTestId('chat-copy-answer').last().click()+ await expect(page.getByTestId('chat-copy-answer').last()).toBeFocused()+}++async function launch(name: string) {+ const app = await electron.launch({ args: [main], env: {+ ...process.env, YOGURT_FAKE: '1', YOGURT_FAKE_LLM_MS: '60', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), `yogurt-${name}-`)),+ } })+ const page = await app.firstWindow()+ await expect(page.getByTestId('home')).toBeVisible()+ return { app, page }+}++test('the note panel keeps focus in the box through a whole answer', async () => {+ const { app, page } = await launch('ask-focus-panel')+ try {+ const meeting = await app.evaluate(() => (globalThis as any).__fake__.bigMeeting(5)) as string+ await page.evaluate(id => window.yogurt.nav.go(`/note/${id}`), meeting)+ await expect(page.getByTestId('chat-open')).toBeVisible()+ await page.keyboard.press('Meta+j')+ await keepsFocus(page, 'chat')+ } finally { await app.close() }+})++test('the Ask page keeps focus in the box through a whole answer', async () => {+ const { app, page } = await launch('ask-focus-page')+ try {+ await page.getByTestId('nav-chat').click()+ await expect(page.getByTestId('chat-empty')).toBeVisible()+ await keepsFocus(page, 'chat-page')+ } finally { await app.close() }+})++test('Back to latest floats 8px above the box in the panel and on the page', async () => {+ const { app, page } = await launch('ask-latest-gap')+ try {+ const meeting = await app.evaluate(() => (globalThis as any).__fake__.bigMeeting(5)) as string+ await page.evaluate(id => window.yogurt.nav.go(`/note/${id}`), meeting)+ await expect(page.getByTestId('chat-open')).toBeVisible()+ await page.keyboard.press('Meta+j')+ const input = page.getByTestId('chat-input')+ await input.fill('Hello'); await input.press('Enter')+ await expect(page.getByTestId('chat-turn')).toHaveAttribute('data-status', 'done', { timeout: 15_000 })+ const view = await page.evaluate(async id => window.yogurt.conversations.get(await window.yogurt.conversations.current([{ kind: 'meeting', id }])), meeting)+ await app.evaluate(({ ipcMain }, view) => {+ ipcMain.removeHandler('conversations:get')+ ipcMain.handle('conversations:get', () => ({ ...view, turns: Array.from({ length: 30 }, (_, i) => ({+ id: i + 1, question: `Question ${i + 1}`, answer: 'A saved paragraph about the meeting. '.repeat(20), status: 'done', sources: [],+ })) }))+ }, view)+ await input.press('Escape'); await page.keyboard.press('Meta+j')+ const gap = async (prefix: string) => {+ await page.locator('.ask-thread').evaluate(el => { el.scrollTop = 0; el.dispatchEvent(new Event('scroll')) })+ await expect(page.getByTestId('chat-latest')).toBeVisible()+ const button = (await page.getByTestId('chat-latest').boundingBox())!+ const box = (await page.getByTestId(`${prefix}-box`).boundingBox())!+ expect(button.y + button.height).toBeLessThanOrEqual(box.y - 6)+ }+ await gap('chat')+ await page.getByTestId('chat-expand').click()+ await expect(page.getByTestId('chat-page-turn')).toHaveCount(30)+ await gap('chat-page')+ } finally { await app.close() }+})diff --git a/app/e2e/chat.spec.ts b/app/e2e/chat.spec.tsindex b20c2a1d..6bba2910 100644--- a/app/e2e/chat.spec.ts+++ b/app/e2e/chat.spec.ts@@ -286,7 +286,8 @@ test('an unacknowledged question cannot be sent twice, and a rejected request keawait input.fill('Who owns the release notes?')await input.press('Enter')await expect(input).toHaveValue('Who owns the release notes?')- await expect(input).toBeDisabled()+ await expect(input).not.toBeEditable()+ await expect(input).toBeFocused()await expect(send).toBeDisabled()expect(await app.evaluate(() => (globalThis as unknown as { __chatRequestTest: { calls: number } }).__chatRequestTest.calls)).toBe(1)await app.evaluate(() => (globalThis as unknown as { __chatRequestTest: { reject(): void } }).__chatRequestTest.reject())diff --git a/app/src/renderer/src/components/AskConversation.tsx b/app/src/renderer/src/components/AskConversation.tsxindex e8cdd300..d724f5d7 100644--- a/app/src/renderer/src/components/AskConversation.tsx+++ b/app/src/renderer/src/components/AskConversation.tsx@@ -134,8 +134,11 @@ export function AskConversation({ id, initial, home = false, panel = false, recocatch { focusAfterRemove.current = false; setError(true) }finally { setChanging(false) }}+ // Sending from the box (Enter, the send button or a starter) keeps the person in it; the button turns into Stop and starters go. A disabled field would drop focus, so it is read-only while saving.+ const keepTyping = () => { const from = document.activeElement; if (from === document.body || from?.closest('.ask-box, .ask-starters')) input.current?.focus({ preventScroll: true }) }const send = (q: string) => {if (!q.trim() || busy) return+ keepTyping()stuck.current = true; setBehind(false); setSending(true); setError(false); setMention(undefined)void window.yogurt.conversations.ask(id, q).then(made => {if (!made) throw new Error('Question was not saved')@@ -186,7 +189,7 @@ export function AskConversation({ id, initial, home = false, panel = false, reco<AskContext chips={chips} disabled={busy} onRemove={remove} /><div className="ask-field"><textarea ref={input} id={panel ? 'meeting-question' : 'library-question'} data-testid={`${prefix}-input`} rows={1} maxLength={4000}- placeholder={panel ? t('Ask anything') : t('Ask about your meetings')} aria-label={panel ? t('Ask anything') : t('Ask about your meetings')} value={text} disabled={!chat || sending || changing}+ placeholder={panel ? t('Ask anything') : t('Ask about your meetings')} aria-label={panel ? t('Ask anything') : t('Ask about your meetings')} value={text} disabled={!chat} readOnly={sending || changing}role="combobox" aria-autocomplete="list" aria-expanded={!!mention} aria-controls={mention ? `${prefix}-contexts` : undefined}aria-activedescendant={mention && targets[selected] ? `${prefix}-context-${selected}` : undefined}onChange={e => { saveText(e.target.value); detectMention(e.target.value, e.target.selectionStart) }}@@ -199,7 +202,7 @@ export function AskConversation({ id, initial, home = false, panel = false, recosaveText(value); detectMention(value, caret + token.length)input.current?.focus(); requestAnimationFrame(() => input.current?.setSelectionRange(caret + token.length, caret + token.length))}}><AtSign size={16} aria-hidden="true" /></button>- {answering ? <button type="button" data-testid={`${prefix}-stop`} className="ask-toolbar-button ask-send" aria-label={chat?.waitsForModel ? t('Cancel question') : t('Stop')} title={chat?.waitsForModel ? t('Cancel question') : t('Stop')} onClick={() => window.yogurt.conversations.stop(id)}><Square size={10} fill="currentColor" /></button>+ {answering ? <button type="button" data-testid={`${prefix}-stop`} className="ask-toolbar-button ask-send" aria-label={chat?.waitsForModel ? t('Cancel question') : t('Stop')} title={chat?.waitsForModel ? t('Cancel question') : t('Stop')} onClick={() => { keepTyping(); window.yogurt.conversations.stop(id) }}><Square size={10} fill="currentColor" /></button>: <button type="submit" data-testid={`${prefix}-send`} className="ask-toolbar-button ask-send" disabled={busy || !text.trim()} aria-label={t('Ask')}><ArrowUp size={16} /></button>}</div></div>diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.cssindex f679cfed..6e1013ae 100644--- a/app/src/renderer/src/styles.css+++ b/app/src/renderer/src/styles.css@@ -561,7 +561,7 @@ input::selection, textarea::selection, .note-prose ::selection { background: var.chat-icon { display:grid;place-items:center;width:28px;height:28px;flex-shrink:0;border-radius:5px;color:var(--muted); }.chat-icon:hover,.chat-icon[aria-expanded=true] { background:var(--control);color:var(--ink); }-.chat-latest { position:absolute;z-index:1;bottom:0;inset-inline-start:calc(50% - 15px);display:grid;place-items:center;width:30px;height:30px;border:1px solid var(--line);border-radius:50%;background:var(--float);color:var(--muted);box-shadow:var(--shadow-soft); }+.chat-latest { position:absolute;z-index:1;bottom:8px;inset-inline-start:calc(50% - 15px);display:grid;place-items:center;width:30px;height:30px;border:1px solid var(--line);border-radius:50%;background:var(--float);color:var(--muted);box-shadow:var(--shadow-soft); }.chat-answer-actions { display:flex;align-items:center;gap:8px;margin-top:6px; }.chat-copy-action { display:inline-flex;align-items:center;gap:5px;padding:4px 5px;margin-inline-start:-5px;min-height:28px;border-radius:5px;font-size:11px;color:var(--muted); }.chat-copy-action:hover { background:var(--control);color:var(--ink); }