File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ async def delete_all_memories() -> str:
314314 # delete the accessible memories only
315315 for memory_id in accessible_memory_ids :
316316 try :
317- memory_client .delete (memory_id )
317+ memory_client .delete (str ( memory_id ) )
318318 except Exception as delete_error :
319319 logging .warning (f"Failed to delete memory { memory_id } from vector store: { delete_error } " )
320320
Original file line number Diff line number Diff line change @@ -360,8 +360,32 @@ async def delete_memories(
360360 if not user :
361361 raise HTTPException (status_code = 404 , detail = "User not found" )
362362
363+ # Get memory client to delete from vector store
364+ try :
365+ memory_client = get_memory_client ()
366+ if not memory_client :
367+ raise HTTPException (
368+ status_code = 503 ,
369+ detail = "Memory client is not available"
370+ )
371+ except HTTPException :
372+ raise
373+ except Exception as client_error :
374+ logging .error (f"Memory client initialization failed: { client_error } " )
375+ raise HTTPException (
376+ status_code = 503 ,
377+ detail = f"Memory service unavailable: { str (client_error )} "
378+ )
379+
380+ # Delete from vector store then mark as deleted in database
363381 for memory_id in request .memory_ids :
382+ try :
383+ memory_client .delete (str (memory_id ))
384+ except Exception as delete_error :
385+ logging .warning (f"Failed to delete memory { memory_id } from vector store: { delete_error } " )
386+
364387 update_memory_state (db , memory_id , MemoryState .deleted , user .id )
388+
365389 return {"message" : f"Successfully deleted { len (request .memory_ids )} memories" }
366390
367391
You can’t perform that action at this time.
0 commit comments