MCPcopy
hub / github.com/ModelEngine-Group/nexent / addMemory

Function addMemory

frontend/services/memoryService.ts:366–390  ·  view source on GitHub ↗
(
  messages: Array<{ role: string; content: string }>,
  memoryLevel: string,
  agentId?: string,
  infer: boolean = true
)

Source from the content-addressed store, hash-verified

364// ---------------------------------------------------------------------------
365
366export async function addMemory(
367 messages: Array<{ role: string; content: string }>,
368 memoryLevel: string,
369 agentId?: string,
370 infer: boolean = true
371): Promise<boolean> {
372 try {
373 const body = {
374 messages,
375 memory_level: memoryLevel,
376 infer,
377 ...(agentId && { agent_id: agentId }),
378 };
379 const res = await requestJson(API_ENDPOINTS.memory.entry.add, {
380 method: "POST",
381 headers: getAuthHeaders(),
382 body: JSON.stringify(body),
383 });
384 // Backend returns inserted info or payload directly on success
385 return !!res;
386 } catch (e) {
387 log.error("addMemory error", e);
388 throw e;
389 }
390}
391
392export async function clearMemory(
393 memoryLevel: string,

Callers 1

useMemoryFunction · 0.90

Calls 3

getAuthHeadersFunction · 0.90
errorMethod · 0.80
requestJsonFunction · 0.70

Tested by

no test coverage detected