Skip to content

fix(tools): search.py 短前缀 paper_id 导致 get_paper_detail/get_similar/citation_tree 崩 - #61

Merged
Color2333 merged 1 commit into
mainfrom
fix/tool-search-short-prefix
Jul 19, 2026
Merged

fix(tools): search.py 短前缀 paper_id 导致 get_paper_detail/get_similar/citation_tree 崩#61
Color2333 merged 1 commit into
mainfrom
fix/tool-search-short-prefix

Conversation

@Color2333

Copy link
Copy Markdown
Owner

PR #60 修了 read/figures/reasoning 的短前缀 bug,但 search.py 仍有同根 bug:get_paper_detail/get_similar_papers/get_citation_tree 用 UUID(paper_id) 崩短前缀。修复:统一用 _require_paper 返回的 paper.id。测试 69 passed/2 skipped。

…tation_tree 崩

PR #60 修了 read/figures/reasoning,但 search.py 仍有同样 bug:
- _get_paper_detail: line 53 用 UUID(paper_id) 重新查(既多余又崩短前缀),
  且 line 49 已调 _require_paper 拿到完整论文对象,直接用即可
- _get_similar_papers: line 78 UUID(paper_id) 崩;line 107 返回原始短前缀给 LLM
- _get_citation_tree: line 181 传原始 paper_id 给 GraphService.citation_tree,
  内部用 paper.id 作 dict key,短前缀不匹配 → root_paper 为 None

修复:
- _get_paper_detail: 用 _require_paper 返回的 p 直接构造 data,删重复 UUID 查询
- _get_similar_papers: pid = UUID(paper.id);返回 paper.id 给 LLM
- _get_citation_tree: 用 paper.id 传给 citation_tree

实测前:生产 b7e07388 → LLM 先调 get_paper_detail → "badly formed hexadecimal UUID",
LLM 改调 search_papers(keyword=b7e07388) → 0 结果 → 放弃。
修复后:get_paper_detail 直接用 _require_paper 解析的完整论文,短前缀可用。

测试:69 passed / 2 skipped(无回归)。
@github-actions

Copy link
Copy Markdown

🔍 OpenCode PR Review Required

这是一个受保护的分支,merge 前需要进行 code review。

请运行以下命令进行 OpenCode review:

/oc review https://github.com/Color2333/PaperMind/pull/$PR_NUM

或者在 PR 页面评论 /oc 来触发 OpenCode review。


This is an automated reminder from PR Review Gate.

@Color2333
Color2333 merged commit 261366f into main Jul 19, 2026
2 checks passed
@Color2333
Color2333 deleted the fix/tool-search-short-prefix branch July 19, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant