fix: issue https://github.com/infiniflow/ragflow/issues/5600 ### What problem does this PR solve? close issue https://github.com/infiniflow/ragflow/issues/5600 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)tags/v0.17.1
| response = re.sub(r"\{\{", "{", response) | response = re.sub(r"\{\{", "{", response) | ||||
| response = re.sub(r"\}\}", "}", response) | response = re.sub(r"\}\}", "}", response) | ||||
| logging.debug(response) | logging.debug(response) | ||||
| response = json.loads(response) | |||||
| try: | |||||
| response = json.loads(response) | |||||
| except json.JSONDecodeError as e: | |||||
| logging.error(f"Failed to parse JSON response: {e}") | |||||
| logging.error(f"Response content: {response}") | |||||
| continue | |||||
| if not dict_has_keys_with_types(response, [ | if not dict_has_keys_with_types(response, [ | ||||
| ("title", str), | ("title", str), | ||||
| ("summary", str), | ("summary", str), |
| result = {} | result = {} | ||||
| results_by_level[level] = result | results_by_level[level] = result | ||||
| for node_id, raw_community_id in node_id_to_community_map[level].items(): | for node_id, raw_community_id in node_id_to_community_map[level].items(): | ||||
| if node_id not in graph.nodes: | |||||
| logging.warning(f"Node {node_id} not found in the graph.") | |||||
| continue | |||||
| community_id = str(raw_community_id) | community_id = str(raw_community_id) | ||||
| if community_id not in result: | if community_id not in result: | ||||
| result[community_id] = {"weight": 0, "nodes": []} | result[community_id] = {"weight": 0, "nodes": []} |