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