yangdx
commited on
Commit
·
872fd57
1
Parent(s):
60dd37e
Fix data format convert problem for PostgreSQL graph storage
Browse files
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 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
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 |
|