| 17 | }; |
| 18 | |
| 19 | export const MemoryPanel = () => { |
| 20 | const { t } = useTranslation(); |
| 21 | const memory = useEditorStore((s) => s.memory); |
| 22 | const selection = useEditorStore((s) => s.selection); |
| 23 | const selectMemory = useEditorStore((s) => s.selectMemory); |
| 24 | const byMemoryId = useDiagnosticsStore((s) => s.byMemoryId); |
| 25 | |
| 26 | const add = (type: MemoryType) => selectMemory(addMemory(type).id); |
| 27 | |
| 28 | return ( |
| 29 | <ResourceListPanel |
| 30 | items={Object.values(memory)} |
| 31 | selectedId={selection.kind === "memory" ? selection.id : null} |
| 32 | onSelect={selectMemory} |
| 33 | diagnosticsSlot={byMemoryId} |
| 34 | badge={(m) => TYPE_BADGE[m.type]} |
| 35 | emptyIcon={Database} |
| 36 | emptyText={t("noMemory", "No memory declared yet")} |
| 37 | emptyHint={t("noMemoryHint", "Declare memory files for agents and vector databases for RAG")} |
| 38 | addActions={[ |
| 39 | { label: t("addMemoryFile", "Add Memory File"), icon: FileText, onAdd: () => add("MemoryFile") }, |
| 40 | { label: t("addVectorDatabase", "Add Vector Database"), icon: Database, onAdd: () => add("VectorDatabase") }, |
| 41 | ]} |
| 42 | /> |
| 43 | ); |
| 44 | }; |