Skip to content

Commit

Permalink
Merge pull request #82 from codefuse-ai/memory_dev2
Browse files Browse the repository at this point in the history
[nebula]add_nodes func support more attributes
  • Loading branch information
lightislost authored Nov 19, 2024
2 parents 8471385 + 68d177f commit ed1f5b9
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions muagent/db_handler/graph_db_handler/nebula_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,10 @@ def add_node(self, node: GNode) -> GbaseExecStatus:
for prop_name in properties_name:
value = node_attributes.get(prop_name)
if isinstance(value, str):
if prop_name == 'extra':
# 转义双引号
# value = value.replace('"', '\\"')
if prop_name in {'extra', 'description', 'envdescription','updaterule'}:
# 转义换行符和双引号
value = value.replace("\n", "\\n").replace("\"", "\\\"")
cypher += f'"{value}",'
elif prop_name == 'description':
value = value.replace("\n", "\\n").replace("\"", "\\\"")
cypher += f'"{value}",'
elif prop_name == 'envdescription':
value = value.replace("\n", "\\n").replace("\"", "\\\"")
cypher += f'"{value}",'
else:
cypher += f'"{value}",'
#cypher += f'"{value}",'
cypher += f'"{value}",'
else:
cypher += f'{value},'
cypher = cypher.rstrip(',')
Expand Down

0 comments on commit ed1f5b9

Please sign in to comment.