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

Function _append_template_qa_block

agents/reading-agent/main.py:4173–4206  ·  view source on GitHub ↗
(
    lines: List[str],
    qid: str,
    question: str,
    content: Any,
    response_language: str = "zh",
)

Source from the content-addressed store, hash-verified

4171
4172def _append_template_qa_block(
4173 lines: List[str],
4174 qid: str,
4175 question: str,
4176 content: Any,
4177 response_language: str = "zh",
4178) -> None:
4179 fallback = (
4180 "Current information is insufficient; check the corresponding section in the original paper."
4181 if _normalize_response_language(response_language) == "en"
4182 else "当前信息不足,建议回到原文对应章节核对。"
4183 )
4184 lines.append(f"{qid}: {question}")
4185 lines.append("")
4186 if isinstance(content, list):
4187 values = [_clean_text(item) for item in content if _clean_text(item)]
4188 if values:
4189 for item in values:
4190 lines.append(f"- {item}")
4191 else:
4192 lines.append(fallback)
4193 else:
4194 text = _clean_text(content)
4195 if text:
4196 for paragraph in re.split(r"\n{2,}", text):
4197 paragraph = paragraph.strip()
4198 if paragraph:
4199 lines.append(paragraph)
4200 lines.append("")
4201 if lines and lines[-1] == "":
4202 lines.pop()
4203 else:
4204 lines.append(fallback)
4205 lines.append("")
4206
4207
4208def _synthesize_report_with_llm(
4209 paper: Dict[str, Any],

Callers 1

generate_reading_reportFunction · 0.85

Calls 2

_clean_textFunction · 0.70

Tested by

no test coverage detected