From 06b29d7da4a8315d4b72664cb59f507baae53a9d Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 7 Mar 2025 11:23:37 +0800 Subject: [PATCH] Fix: empty description (#5747) ### What problem does this PR solve? #5705 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- graphrag/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphrag/search.py b/graphrag/search.py index 66e36bf7e..aa65fc6f5 100644 --- a/graphrag/search.py +++ b/graphrag/search.py @@ -228,7 +228,7 @@ class KGSearch(Dealer): ents.append({ "Entity": n, "Score": "%.2f" % (ent["sim"] * ent["pagerank"]), - "Description": json.loads(ent["description"]).get("description", "") + "Description": json.loads(ent["description"]).get("description", "") if ent["description"] else "" }) max_token -= num_tokens_from_string(str(ents[-1])) if max_token <= 0: