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

Function _build_doc_tracking_url

agents/reading-agent/main.py:1245–1265  ·  view source on GitHub ↗
(
    *,
    doc_url: str,
    user_id: str,
    doc_token: str = "",
    paper_title: str = "",
)

Source from the content-addressed store, hash-verified

1243
1244def _build_doc_tracking_url(
1245 *,
1246 doc_url: str,
1247 user_id: str,
1248 doc_token: str = "",
1249 paper_title: str = "",
1250) -> str:
1251 base_url = _load_public_webhook_base_url()
1252 normalized_doc_url = _clean_text(doc_url)
1253 if not base_url or not normalized_doc_url.startswith(("http://", "https://")):
1254 return normalized_doc_url
1255
1256 params = [
1257 f"target={quote(normalized_doc_url, safe='')}",
1258 f"user_id={quote(str(user_id or '').strip(), safe='')}",
1259 ]
1260 if doc_token:
1261 params.append(f"doc_token={quote(str(doc_token).strip(), safe='')}")
1262 if paper_title:
1263 params.append(f"title={quote(_clean_text(paper_title), safe='')}")
1264 return f"{base_url}/r/doc?{'&'.join(params)}"
1265
1266
1267def _annotate_tracking_links(created_docs: List[Dict[str, Any]], user_id: str) -> None:
1268 for doc in created_docs:

Callers 1

_annotate_tracking_linksFunction · 0.85

Calls 2

_clean_textFunction · 0.70

Tested by

no test coverage detected