Add specific driver closing to avoid issues with neo4
This commit is contained in:
parent
0120421195
commit
8aeef5ca4f
2 changed files with 3 additions and 3 deletions
2
api.py
2
api.py
|
|
@ -306,7 +306,7 @@ async def unlink_user_from_public_memory(payload: Payload):
|
||||||
async with session_scope(session=AsyncSessionLocal()) as session:
|
async with session_scope(session=AsyncSessionLocal()) as session:
|
||||||
from main import unlink_user_from_memory
|
from main import unlink_user_from_memory
|
||||||
# Assuming you have a method in Neo4jGraphDB to execute the query
|
# 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)
|
return JSONResponse(content={"response": result}, status_code=200)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
4
main.py
4
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.")
|
raise ValueError("User ID is required.")
|
||||||
if not labels:
|
if not labels:
|
||||||
labels = ['sr'] # Labels for the memory node
|
labels = ['sr'] # Labels for the memory node
|
||||||
raise ValueError("Labels are required, default label 'sr' provided")
|
|
||||||
if not topic:
|
if not topic:
|
||||||
topic = "PublicMemory"
|
topic = "PublicMemory"
|
||||||
raise ValueError("Topic is required, default topic 'PublicMemory' provided")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url,
|
neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue