( memoryLevel: string, agentId?: string )
| 390 | } |
| 391 | |
| 392 | export async function clearMemory( |
| 393 | memoryLevel: string, |
| 394 | agentId?: string |
| 395 | ): Promise<{ deleted_count: number; total_count: number }> { |
| 396 | try { |
| 397 | const params = new URLSearchParams({ memory_level: memoryLevel }); |
| 398 | if (agentId) params.append("agent_id", agentId); |
| 399 | const url = `${API_ENDPOINTS.memory.entry.clear}?${params.toString()}`; |
| 400 | |
| 401 | const res = await requestJson(url, { |
| 402 | method: "DELETE", |
| 403 | headers: getAuthHeaders(), |
| 404 | }); |
| 405 | const result = res || { deleted_count: 0, total_count: 0 }; |
| 406 | return result; |
| 407 | } catch (e) { |
| 408 | log.error("clearMemory error", e); |
| 409 | throw e; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | export async function deleteMemory( |
| 414 | memoryId: string, |
no test coverage detected