(
user_id: str,
pdf_path: str,
title: str = "",
write_feishu: Optional[bool] = None,
response_language: str = "zh",
)
| 2549 | evidence_numbers = sorted(selected | skipped | later) |
| 2550 | evidence_papers = [papers[number - 1] for number in evidence_numbers if 1 <= number <= len(papers)] |
| 2551 | feedback_agent.ingest_profile_drift_to_wiki( |
| 2552 | user_id=user_id, |
| 2553 | before=profile_before, |
| 2554 | after=updated_profile or {}, |
| 2555 | evidence_papers=evidence_papers, |
| 2556 | source_ref=push_id, |
| 2557 | ) |
| 2558 | |
| 2559 | return { |
| 2560 | "status": "success", |
| 2561 | "push_id": push_id, |
| 2562 | "selected_numbers": sorted(selected), |
| 2563 | "newly_selected_numbers": sorted(new_selected), |
| 2564 | "skipped_numbers": sorted(skipped), |
| 2565 | "later_numbers": sorted(later), |
| 2566 | "profile": _profile_summary(updated_profile), |
| 2567 | } |
| 2568 | |
| 2569 | |
| 2570 | def _resolve_project_path(value: Any) -> Optional[Path]: |
| 2571 | raw = str(value or "").strip() |
| 2572 | if not raw: |
| 2573 | return None |
| 2574 | path = Path(raw).expanduser() |
| 2575 | if not path.is_absolute(): |
| 2576 | path = PROJECT_ROOT / path |
| 2577 | return path |
| 2578 | |
| 2579 | |
| 2580 | def _backfill_docs_to_wiki(user_id: str, docs: Iterable[Dict[str, Any]]) -> int: |
| 2581 | """Best-effort Wiki ingest for reused reading reports returned by the GUI.""" |
| 2582 | ingest = getattr(reading_agent, "ingest_reading_report_to_wiki", None) |
| 2583 | if ingest is None: |
| 2584 | return 0 |
| 2585 | |
| 2586 | backfilled = 0 |
| 2587 | for doc in docs or []: |
| 2588 | if doc.get("wiki_ingest"): |
| 2589 | continue |
| 2590 | report_path = _resolve_project_path(doc.get("report_path")) |
| 2591 | if not report_path or not report_path.exists() or not report_path.is_file(): |
| 2592 | continue |
| 2593 | try: |
| 2594 | raw = report_path.read_text(encoding="utf-8") |
nothing calls this directly
no test coverage detected