(base: Dict[str, Any], llm_payload: Optional[Dict[str, Any]])
| 4262 | |
| 4263 | |
| 4264 | def _merge_report_payload(base: Dict[str, Any], llm_payload: Optional[Dict[str, Any]]) -> Dict[str, Any]: |
| 4265 | if not isinstance(llm_payload, dict): |
| 4266 | return base |
| 4267 | |
| 4268 | merged = dict(base) |
| 4269 | for key in ( |
| 4270 | "one_sentence_summary", |
| 4271 | "clean_abstract_summary", |
| 4272 | "problem_analysis", |
| 4273 | "related_work", |
| 4274 | "solution_approach", |
| 4275 | "experiments", |
| 4276 | "experimental_observations", |
| 4277 | "future_directions", |
| 4278 | "paper_summary", |
| 4279 | "research_background", |
| 4280 | "core_method", |
| 4281 | "key_results", |
| 4282 | "institution", |
| 4283 | "affiliation", |
| 4284 | ): |
| 4285 | value = _clean_text(llm_payload.get(key)) |
| 4286 | if value: |
| 4287 | merged["institution" if key == "affiliation" else key] = value |
| 4288 | |
| 4289 | analysis_note = _clean_text(llm_payload.get("analysis_note")) |
| 4290 | if analysis_note: |
| 4291 | merged["analysis_note"] = _append_analysis_note(merged.get("analysis_note"), analysis_note) |
| 4292 | |
| 4293 | for key in ("main_contributions", "limitations", "relevance_points", "reading_focus"): |
| 4294 | values = _normalize_string_list(llm_payload.get(key), max_chars=320) |
| 4295 | if values: |
| 4296 | merged[key] = values |
| 4297 | |
| 4298 | keyword_values = _normalize_string_list(llm_payload.get("keywords"), limit=8) |
| 4299 | if keyword_values: |
| 4300 | merged["keywords"] = keyword_values |
| 4301 | |
| 4302 | recommendation_label = _clean_text(llm_payload.get("recommendation_label")) |
| 4303 | if recommendation_label: |
| 4304 | merged["recommendation_label"] = recommendation_label |
| 4305 | |
| 4306 | for key in ("generation_provider", "generation_model"): |
| 4307 | value = _clean_text(llm_payload.get(key)) |
| 4308 | if value: |
| 4309 | merged[key] = value |
| 4310 | |
| 4311 | return merged |
| 4312 | |
| 4313 | |
| 4314 | def _resolve_doc_url_from_meta(doc_token: Optional[str]) -> Optional[str]: |
no test coverage detected