MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / saveMemory

Function saveMemory

apps/webuiapps/src/lib/memoryManager.ts:113–138  ·  view source on GitHub ↗
(
  sessionPath: string,
  content: string,
  category: string,
)

Source from the content-addressed store, hash-verified

111
112/** Save a single memory entry */
113export async function saveMemory(
114 sessionPath: string,
115 content: string,
116 category: string,
117): Promise<MemoryEntry> {
118 const entry: MemoryEntry = {
119 id: `mem_${Date.now()}`,
120 content,
121 category: (['fact', 'preference', 'event', 'emotion'].includes(category)
122 ? category
123 : 'other') as MemoryEntry['category'],
124 createdAt: Date.now(),
125 };
126
127 try {
128 await fetch(memoryApiUrl(sessionPath, `${entry.id}.json`), {
129 method: 'POST',
130 headers: { 'Content-Type': 'application/json' },
131 body: JSON.stringify(entry),
132 });
133 } catch {
134 // silently ignore
135 }
136
137 return entry;
138}
139
140/** Execute the save_memory tool call */
141export async function executeMemoryTool(

Callers 1

executeMemoryToolFunction · 0.85

Calls 1

memoryApiUrlFunction · 0.85

Tested by

no test coverage detected