(
result: Dict[str, Any],
*,
mode: str,
retrieval_required: bool,
routing_reason: str,
mentions: List[Dict[str, Any]],
unresolved_mentions: List[Dict[str, str]],
scope: str,
response_language: str = "zh",
)
| 4497 | paper.get("summary"), |
| 4498 | paper.get("keywords"), |
| 4499 | paper.get("category"), |
| 4500 | paper.get("source"), |
| 4501 | paper.get("subjects"), |
| 4502 | paper.get("categories"), |
| 4503 | metadata.get("category"), |
| 4504 | metadata.get("keywords"), |
| 4505 | metadata.get("subjects"), |
| 4506 | metadata.get("categories"), |
| 4507 | ] |
| 4508 | return " ".join( |
| 4509 | " ".join(_compact_list(piece, limit=12)) if isinstance(piece, (list, tuple)) else str(piece or "") |
| 4510 | for piece in pieces |
| 4511 | ).lower() |
| 4512 | |
| 4513 | |
| 4514 | def _recent_paper_context_nodes(user_id: str, question: str = "", limit: int = 8) -> List[Dict[str, Any]]: |
| 4515 | try: |
| 4516 | papers = db_ops.get_recent_pushes(user_id, limit=max(12, min(50, int(limit or 8) * 4))) or [] |
| 4517 | except Exception: |
| 4518 | papers = [] |
| 4519 | if not papers: |
| 4520 | try: |
| 4521 | latest = db_ops.get_latest_push(user_id) or {} |
| 4522 | except Exception: |
| 4523 | latest = {} |
| 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: |
no test coverage detected