Skip to content

Commit c9974de

Browse files
Merge pull request #30 from off-grid-ai/fix/no-memory-waiting-label
fix(chat): no-memory chat no longer says "Searching your memory…"
2 parents 4eaa5bb + c0133c3 commit c9974de

5 files changed

Lines changed: 38 additions & 1 deletion

File tree

110 KB
Loading
131 KB
Loading

src/renderer/src/components/MemoryChat.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useCallback, useEffect, useRef, useState } from 'react';
22
import { shouldQueue, enqueue, dequeue, queuedCount } from '@renderer/lib/chat-queue';
3+
import { waitingLabel } from '@renderer/lib/chat-labels';
34
import ReactMarkdown, { Components } from 'react-markdown';
45
import remarkGfm from 'remark-gfm';
56
import remarkBreaks from 'remark-breaks';
@@ -1940,7 +1941,7 @@ export function MemoryChat({ onNavigateToMemory, onNavigateToChat, onNavigateToE
19401941
<span className="h-1.5 w-1.5 animate-bounce rounded-full bg-green-500 [animation-delay:150ms]" />
19411942
<span className="h-1.5 w-1.5 animate-bounce rounded-full bg-green-500 [animation-delay:300ms]" />
19421943
</span>
1943-
<span className="text-xs text-neutral-500">Searching your memory…</span>
1944+
<span className="text-xs text-neutral-500">{waitingLabel({ noMemory, hasProject: !!activeProjectId })}</span>
19441945
</div>
19451946
)}
19461947
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { waitingLabel } from '../chat-labels';
3+
4+
describe('waitingLabel — scope-aware "working…" text', () => {
5+
it('No-memory (plain chat) must NOT claim to search memory', () => {
6+
const label = waitingLabel({ noMemory: true, hasProject: false });
7+
expect(label).toBe('Thinking…');
8+
expect(label.toLowerCase()).not.toContain('memory'); // the reported bug
9+
});
10+
11+
it('All-memory searches your memory', () => {
12+
expect(waitingLabel({ noMemory: false, hasProject: false })).toBe('Searching your memory…');
13+
});
14+
15+
it('a project scopes the search to the project (regardless of noMemory)', () => {
16+
expect(waitingLabel({ noMemory: false, hasProject: true })).toBe('Searching this project…');
17+
expect(waitingLabel({ noMemory: true, hasProject: true })).toBe('Searching this project…');
18+
});
19+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// The "working…" label shown while a chat turn is generating, before the first
2+
// token lands. It MUST reflect the chat's memory scope: a plain (no-memory) chat
3+
// never touches memory, so it must not claim to be "Searching your memory".
4+
// Pure + UI-free so it's unit-testable.
5+
6+
export interface ChatScope {
7+
/** A project is active → retrieval is scoped to that project. */
8+
hasProject: boolean;
9+
/** No-memory ("plain chat") mode — no retrieval at all. */
10+
noMemory: boolean;
11+
}
12+
13+
export function waitingLabel(scope: ChatScope): string {
14+
if (scope.hasProject) return 'Searching this project…';
15+
if (scope.noMemory) return 'Thinking…';
16+
return 'Searching your memory…';
17+
}

0 commit comments

Comments
 (0)