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 "streaming": {"provider": False, "transport": "json"},
4498 }
4499
4500
4501def _selection_required_answer_stream(message: str, response_language: str = "zh") -> Iterator[Dict[str, Any]]:
4502 result = _selection_required_answer(message, response_language=response_language)
4503 yield {"event": "meta", "data": {key: value for key, value in result.items() if key != "text"}}
4504 for chunk in _text_chunks(message):
4505 yield {"event": "chunk", "data": {"text": chunk}}
4506 yield {"event": "done", "data": result}
4507
4508
4509def _apply_chat_metadata(
4510 result: Dict[str, Any],
4511 *,
4512 mode: str,
4513 retrieval_required: bool,
4514 routing_reason: str,
4515 mentions: List[Dict[str, Any]],
4516 unresolved_mentions: List[Dict[str, str]],
4517 scope: str,
4518 response_language: str = "zh",
4519) -> Dict[str, Any]:
4520 citations = result.get("citations") or []
4521 result["sources"] = [_citation_source_payload(citation) for citation in citations]
4522 result.update(
4523 {
4524 "mode": mode,
4525 "retrieval_required": retrieval_required,
4526 "routing_reason": routing_reason,

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