(result: Dict[str, Any])
| 4524 | papers = list(latest.get("papers") or [])[: max(12, min(50, int(limit or 8) * 4))] |
| 4525 | query_tokens = _local_paper_query_tokens(question) |
| 4526 | if query_tokens: |
| 4527 | matched = [paper for paper in papers if isinstance(paper, dict) and any(token in _paper_query_haystack(paper) for token in query_tokens)] |
| 4528 | if matched: |
| 4529 | papers = matched |
| 4530 | |
| 4531 | nodes: List[Dict[str, Any]] = [] |
| 4532 | seen: Set[str] = set() |
| 4533 | for index, paper in enumerate(papers, start=1): |
| 4534 | if not isinstance(paper, dict): |
| 4535 | continue |
| 4536 | title = str(paper.get("title") or "").strip() |
| 4537 | if not title: |
| 4538 | continue |
| 4539 | arxiv_id = _paper_arxiv_id(paper) |
| 4540 | key = arxiv_id or str(paper.get("doi") or paper.get("id") or title).strip() |
| 4541 | node_id = f"paper:{hashlib.sha1(key.encode('utf-8')).hexdigest()[:16]}" |
| 4542 | if node_id in seen: |
| 4543 | continue |
| 4544 | seen.add(node_id) |
no test coverage detected