MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _apply_chat_metadata

Function _apply_chat_metadata

deployments/desktop/shared/agents.py:4499–4523  ·  view source on GitHub ↗
(
    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",
)

Source from the content-addressed store, hash-verified

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
4514def _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:

Callers 2

wiki_askFunction · 0.85
wiki_ask_streamFunction · 0.85

Calls 3

_citation_source_payloadFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected