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

Function _normalize_requested_mentions

deployments/desktop/shared/agents.py:4105–4119  ·  view source on GitHub ↗
(mentions: Any)

Source from the content-addressed store, hash-verified

4103 text = str(question or "")
4104 mentions: List[Dict[str, str]] = []
4105 for match in _MENTION_LINK_RE.finditer(text):
4106 mentions.append({"title": match.group(1).strip(), "node_id": match.group(2).strip()})
4107 stripped = _MENTION_LINK_RE.sub(" ", text)
4108 for match in _MENTION_TOKEN_RE.finditer(stripped):
4109 token = match.group(1).strip()
4110 if token:
4111 mentions.append({"title": token, "node_id": ""})
4112 return mentions
4113
4114
4115def _normalize_requested_mentions(mentions: Any) -> List[Dict[str, str]]:
4116 normalized: List[Dict[str, str]] = []
4117 if not isinstance(mentions, list):
4118 return normalized
4119 for item in mentions:
4120 if isinstance(item, dict):
4121 title = str(item.get("title") or item.get("label") or "").strip()
4122 node_id = str(item.get("node_id") or item.get("id") or "").strip()

Callers 1

_resolve_wiki_mentionsFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected