yangdx commited on
Commit
872fd57
·
1 Parent(s): 60dd37e

Fix data format convert problem for PostgreSQL graph storage

Browse files
Files changed (1) hide show
  1. lightrag/kg/postgres_impl.py +8 -5
lightrag/kg/postgres_impl.py CHANGED
@@ -1100,11 +1100,14 @@ class PGGraphStorage(BaseGraphStorage):
1100
  elif dtype == "edge":
1101
  d[k] = json.loads(v)
1102
  else:
1103
- d[k] = (
1104
- json.loads(v)
1105
- if isinstance(v, str) and ("{" in v or "[" in v)
1106
- else v
1107
- )
 
 
 
1108
 
1109
  return d
1110
 
 
1100
  elif dtype == "edge":
1101
  d[k] = json.loads(v)
1102
  else:
1103
+ try:
1104
+ d[k] = (
1105
+ json.loads(v)
1106
+ if isinstance(v, str) and (v.startswith("{") or v.startswith("["))
1107
+ else v
1108
+ )
1109
+ except json.JSONDecodeError:
1110
+ d[k] = v
1111
 
1112
  return d
1113