InternLM / InternLM/MindSearch

graph.py的add_node函数中存在bug

Open
#286 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.9k
Forks
692
PR merge metrics
No merged PRs in 30d

Description

再graph.py的add_node函数中存在逻辑上的bug。我们在添加当前节点的时候,想获取父节点的问答对来构建parent_response。但是构建parent_response的逻辑是在add_edge之前,导致在add_node中遍历adjacency_list时,adjacency_list中相邻节点永远不会包含当前节点,所以parent_response永远都为空。
![image](https://github.com/user-attachments/assets/6083aa86-5272-43dc-ba8b-be658cde0e43)
比如这里,current node为"诺布朗杰作品",其parent node为“作词人”,adjacency_list[“作词人”] = [],因此parent_nodes构建为[],parent_resonse也为[]。这样后面searcher中构建prompt时会缺失父节点的问答信息。

我将代码修改如下:
![image](https://github.com/user-attachments/assets/f4f0691f-93fd-4b3d-bab7-80e186f0844e)
这样就可以在add_node时正常获取当前节点的父节点的问答对。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.