Best-effort Wiki ingest for reused reading reports returned by the GUI.
(user_id: str, docs: Iterable[Dict[str, Any]])
| 2417 | # _DAILY_TASK_LOCK immediately, so starting it here would deadlock against |
| 2418 | # the block above. payload is already a snapshot taken under the lock. |
| 2419 | thread.start() |
| 2420 | return {"task": payload, "already_running": False} |
| 2421 | |
| 2422 | |
| 2423 | def get_daily_push_task(task_id: str = "", user_id: str = "") -> Dict[str, Any]: |
| 2424 | with _DAILY_TASK_LOCK: |
| 2425 | task = _DAILY_TASKS.get(str(task_id or "").strip()) |
| 2426 | if task is None and str(user_id or "").strip(): |
| 2427 | task = _DAILY_TASKS.get(_DAILY_TASK_BY_USER.get(str(user_id).strip(), "")) |
| 2428 | return {"task": _daily_task_payload(task) if task else None} |
| 2429 | |
| 2430 | |
| 2431 | def load_latest_push(user_id: str) -> Dict[str, Any]: |
| 2432 | return {"push": _push_payload(db_ops.get_latest_push(user_id))} |
| 2433 | |
| 2434 | |
| 2435 | def _log_feedback_event( |
| 2436 | *, |
| 2437 | user_id: str, |
| 2438 | push_id: str, |
| 2439 | paper_number: int, |
| 2440 | paper: Dict[str, Any], |
| 2441 | action: str, |
| 2442 | action_type: str, |
| 2443 | category: str, |
| 2444 | ) -> int: |
| 2445 | metadata = { |
| 2446 | "paper_number": paper_number, |
| 2447 | "arxiv_id": paper.get("arxiv_id"), |
| 2448 | "push_context": "desktop_gui", |
| 2449 | "selection_state": action_type, |
| 2450 | } |
| 2451 | behavior_log_id = db_ops.log_behavior( |
| 2452 | user_id=user_id, |
| 2453 | push_id=push_id, |
| 2454 | paper_id=paper.get("id"), |
| 2455 | action=action, |
| 2456 | action_type=action, |
| 2457 | category=category, |
no test coverage detected