tjyiiuan commited on
Commit
afc69f3
·
1 Parent(s): 1e5c642

fix: update operate.py

Browse files

1. 避免变量在赋值之前就被引用
2. 解决未找到entity返回None导致的unpack问题

Files changed (1) hide show
  1. lightrag/operate.py +4 -1
lightrag/operate.py CHANGED
@@ -588,6 +588,9 @@ async def _build_query_context(
588
  text_chunks_db: BaseKVStorage[TextChunkSchema],
589
  query_param: QueryParam,
590
  ):
 
 
 
591
  ll_kewwords, hl_keywrds = query[0], query[1]
592
  if query_param.mode in ["local", "hybrid"]:
593
  if ll_kewwords == "":
@@ -686,7 +689,7 @@ async def _get_node_data(
686
  # get similar entities
687
  results = await entities_vdb.query(query, top_k=query_param.top_k)
688
  if not len(results):
689
- return None
690
  # get entity information
691
  node_datas = await asyncio.gather(
692
  *[knowledge_graph_inst.get_node(r["entity_name"]) for r in results]
 
588
  text_chunks_db: BaseKVStorage[TextChunkSchema],
589
  query_param: QueryParam,
590
  ):
591
+ # ll_entities_context, ll_relations_context, ll_text_units_context = "", "", ""
592
+ # hl_entities_context, hl_relations_context, hl_text_units_context = "", "", ""
593
+
594
  ll_kewwords, hl_keywrds = query[0], query[1]
595
  if query_param.mode in ["local", "hybrid"]:
596
  if ll_kewwords == "":
 
689
  # get similar entities
690
  results = await entities_vdb.query(query, top_k=query_param.top_k)
691
  if not len(results):
692
+ return "", "", ""
693
  # get entity information
694
  node_datas = await asyncio.gather(
695
  *[knowledge_graph_inst.get_node(r["entity_name"]) for r in results]