feat(chat): add AI memory panel with persistent facts (M9.7)

Collapsible memory panel below persona selector. Add/edit/delete
persistent facts (max 20) injected into every system prompt. Facts
stored in localStorage, shown as collapsed "Memory (N/20)" toggle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-03 23:32:42 +00:00
co-authored by Claude Opus 4.6
parent 751edd2790
commit d595996866
4 changed files with 215 additions and 1 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ import { searchWeb } from '@/composables/useWebSearch'
import { getApiKey } from '@/utils/key-vault'
import type { ImageAttachment } from '@aiui/core/types/message'
import { usePersonaStore } from '@/stores/personas'
import { useMemoryStore } from '@/stores/memory'
type Provider = 'claude' | 'openrouter' | 'mock'
@@ -304,7 +305,7 @@ function formatWebSearchContext(results: { title: string; url: string; content?:
- You MAY add [[podcast_ext:...]] or [[film_ext:...]] tags for "to learn more" recommendations after your answer.\n\n${lines.join('\n')}`
}
/** Build the system prompt, incorporating persona if active */
/** Build the system prompt, incorporating persona and memory */
function buildSystemPrompt(chatStore: ReturnType<typeof useChatStore>): string {
let prompt = SYSTEM_PROMPT
@@ -318,6 +319,10 @@ function buildSystemPrompt(chatStore: ReturnType<typeof useChatStore>): string {
}
}
// Append memory facts
const memoryStore = useMemoryStore()
prompt += memoryStore.buildMemoryContext()
if (chatStore.webSearchEnabled) {
prompt += `