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

Function _extractive_fallback

agents/wiki-agent/retrieve/answer.py:99–116  ·  view source on GitHub ↗
(hits: List[Dict[str, Any]], error: str, response_language: str = "zh")

Source from the content-addressed store, hash-verified

97
98
99def _extractive_fallback(hits: List[Dict[str, Any]], error: str, response_language: str = "zh") -> str:
100 if _normalize_response_language(response_language) == "en":
101 lines = [
102 "The current LLM is unavailable, so PaperFlow is returning local Wiki evidence snippets first.",
103 f"Provider error: {error}",
104 "",
105 ]
106 else:
107 lines = [
108 "当前 LLM 不可用,PaperFlow 先返回本地 Wiki 证据片段(local wiki snippets)。",
109 f"Provider error: {error}",
110 "",
111 ]
112 for index, hit in enumerate(hits[:5], start=1):
113 lines.append(f"[{index}] {hit.get('title')} ({hit.get('node_type')})")
114 lines.append(_snippet(hit, max_chars=280))
115 lines.append("")
116 return "\n".join(lines).strip()
117
118
119def _merge_hits(

Callers 2

answer_questionFunction · 0.85
answer_question_streamFunction · 0.85

Calls 3

_snippetFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected