From 8aeef5ca4f793727a683784e852d879b88b49a72 Mon Sep 17 00:00:00 2001 From: Vasilije <8619304+Vasilije1990@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:22:02 +0100 Subject: [PATCH] Add specific driver closing to avoid issues with neo4 --- api.py | 2 +- main.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.py b/api.py index a32242a9b..5b1f1abf5 100644 --- a/api.py +++ b/api.py @@ -306,7 +306,7 @@ async def unlink_user_from_public_memory(payload: Payload): async with session_scope(session=AsyncSessionLocal()) as session: from main import unlink_user_from_memory # Assuming you have a method in Neo4jGraphDB to execute the query - result = await unlink_user_from_memory( user_id = decoded_payload['user_id'], topic=topic) + result = await unlink_user_from_memory( user_id = decoded_payload['user_id'], topic=topic, labels=decoded_payload['labels']) return JSONResponse(content={"response": result}, status_code=200) except Exception as e: diff --git a/main.py b/main.py index a40013c4d..35a159cf5 100644 --- a/main.py +++ b/main.py @@ -574,10 +574,10 @@ async def unlink_user_from_memory(user_id: str=None, labels:list=None, topic:str raise ValueError("User ID is required.") if not labels: labels = ['sr'] # Labels for the memory node - raise ValueError("Labels are required, default label 'sr' provided") + if not topic: topic = "PublicMemory" - raise ValueError("Topic is required, default topic 'PublicMemory' provided") + try: neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url,