Merge pull request #461 from tjyiiuan/main

fix: update operate.py
This commit is contained in:
zrguo 2024-12-13 15:10:53 +08:00 committed by GitHub
commit b7552f35aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -588,6 +588,9 @@ async def _build_query_context(
text_chunks_db: BaseKVStorage[TextChunkSchema], text_chunks_db: BaseKVStorage[TextChunkSchema],
query_param: QueryParam, query_param: QueryParam,
): ):
# ll_entities_context, ll_relations_context, ll_text_units_context = "", "", ""
# hl_entities_context, hl_relations_context, hl_text_units_context = "", "", ""
ll_kewwords, hl_keywrds = query[0], query[1] ll_kewwords, hl_keywrds = query[0], query[1]
if query_param.mode in ["local", "hybrid"]: if query_param.mode in ["local", "hybrid"]:
if ll_kewwords == "": if ll_kewwords == "":
@ -686,7 +689,7 @@ async def _get_node_data(
# get similar entities # get similar entities
results = await entities_vdb.query(query, top_k=query_param.top_k) results = await entities_vdb.query(query, top_k=query_param.top_k)
if not len(results): if not len(results):
return None return "", "", ""
# get entity information # get entity information
node_datas = await asyncio.gather( node_datas = await asyncio.gather(
*[knowledge_graph_inst.get_node(r["entity_name"]) for r in results] *[knowledge_graph_inst.get_node(r["entity_name"]) for r in results]