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:
co-authored by
Claude Opus 4.6
parent
751edd2790
commit
d595996866
@@ -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 += `
|
||||
|
||||
|
||||
Reference in New Issue
Block a user