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

Function wiki_ask_stream

deployments/desktop/shared/agents.py:4784–4900  ·  view source on GitHub ↗
(
    user_id: str,
    question: str,
    limit: int = 8,
    scope: str = "all",
    mentions: Any = None,
    session_id: str = "",
    persist_chat: bool = False,
    response_language: str = "zh",
)

Source from the content-addressed store, hash-verified

4782 response_language=language,
4783 )
4784 _attach_chat_session(
4785 result,
4786 user_id=user_id,
4787 session_id=session_id,
4788 question=cleaned_question,
4789 persist_chat=persist_chat,
4790 )
4791 return result
4792
4793
4794def wiki_ask_stream(
4795 user_id: str,
4796 question: str,
4797 limit: int = 8,
4798 scope: str = "all",
4799 mentions: Any = None,
4800 session_id: str = "",
4801 persist_chat: bool = False,
4802 response_language: str = "zh",
4803) -> Iterator[Dict[str, Any]]:
4804 if not user_id:
4805 raise ValueError("user_id is required")
4806 cleaned_question = str(question or "").strip()
4807 if not cleaned_question:
4808 raise ValueError("question is required")
4809 language = _normalize_response_language(response_language)
4810 safe_limit = max(1, min(12, int(limit or 8)))
4811 normalized_scope = str(scope or "all").strip().lower()
4812 scope_hint = _wiki_scope_hint(normalized_scope, language)
4813 resolved_nodes, resolved_mentions, unresolved_mentions = _resolve_wiki_mentions(
4814 user_id,
4815 cleaned_question,
4816 mentions,
4817 limit=6,
4818 )
4819 mode, routing_reason = _question_route(cleaned_question, normalized_scope, resolved_mentions)
4820 if _comparison_needs_mentions(cleaned_question, resolved_nodes):
4821 for event in _selection_required_answer_stream(
4822 _comparison_selection_required_message(language),
4823 response_language=language,
4824 ):
4825 if event["event"] in {"meta", "done"}:
4826 _apply_chat_metadata(
4827 event["data"],
4828 mode="wiki",
4829 retrieval_required=True,
4830 routing_reason="mention_required",
4831 mentions=resolved_mentions,
4832 unresolved_mentions=unresolved_mentions,
4833 scope=normalized_scope,
4834 response_language=language,
4835 )
4836 if event["event"] == "meta" and session_id:
4837 event["data"]["session_id"] = session_id
4838 if event["event"] == "done":
4839 _attach_chat_session(
4840 event["data"],
4841 user_id=user_id,

Callers

nothing calls this directly

Calls 12

_wiki_scope_hintFunction · 0.85
_resolve_wiki_mentionsFunction · 0.85
_question_routeFunction · 0.85
_apply_chat_metadataFunction · 0.85
_attach_chat_sessionFunction · 0.85
_direct_answer_streamFunction · 0.85
_chat_pinned_nodesFunction · 0.85
_visible_wiki_node_idsFunction · 0.85

Tested by

no test coverage detected