MCPcopy Create free account
hub / github.com/aetherstate/GODMOD3.AI / MemoryTab

Function MemoryTab

SettingsModal.tsx:1345–1657  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1343}
1344
1345function MemoryTab() {
1346 const {
1347 memories,
1348 memoriesEnabled,
1349 setMemoriesEnabled,
1350 addMemory,
1351 updateMemory,
1352 deleteMemory,
1353 toggleMemory,
1354 clearMemories
1355 } = useStore()
1356
1357 const [showAddForm, setShowAddForm] = useState(false)
1358 const [newMemoryContent, setNewMemoryContent] = useState('')
1359 const [newMemoryType, setNewMemoryType] = useState<MemoryType>('fact')
1360 const [editingId, setEditingId] = useState<string | null>(null)
1361 const [editContent, setEditContent] = useState('')
1362 const [showClearConfirm, setShowClearConfirm] = useState(false)
1363
1364 const handleAdd = () => {
1365 if (!newMemoryContent.trim()) return
1366 addMemory({
1367 type: newMemoryType,
1368 content: newMemoryContent.trim(),
1369 source: 'manual',
1370 active: true
1371 })
1372 setNewMemoryContent('')
1373 setNewMemoryType('fact')
1374 setShowAddForm(false)
1375 }
1376
1377 const handleEdit = (id: string) => {
1378 if (!editContent.trim()) return
1379 updateMemory(id, { content: editContent.trim() })
1380 setEditingId(null)
1381 setEditContent('')
1382 }
1383
1384 const startEdit = (id: string, content: string) => {
1385 setEditingId(id)
1386 setEditContent(content)
1387 }
1388
1389 const getTypeIcon = (type: MemoryType) => {
1390 switch (type) {
1391 case 'fact': return <User className="w-3 h-3" />
1392 case 'preference': return <Settings className="w-3 h-3" />
1393 case 'instruction': return <MessageSquare className="w-3 h-3" />
1394 }
1395 }
1396
1397 const getTypeLabel = (type: MemoryType) => {
1398 switch (type) {
1399 case 'fact': return 'Fact'
1400 case 'preference': return 'Preference'
1401 case 'instruction': return 'Instruction'
1402 }

Callers

nothing calls this directly

Calls 5

getTypeColorFunction · 0.70
getTypeIconFunction · 0.70
getTypeLabelFunction · 0.70
handleEditFunction · 0.70
startEditFunction · 0.70

Tested by

no test coverage detected