From d3417e29e1d7e38e2ed6523d5484ef101880a0a9 Mon Sep 17 00:00:00 2001 From: wdm Date: Mon, 30 Mar 2026 01:01:43 +0800 Subject: [PATCH] Support single-item extracted file format in summarize_selected_articles --- src/summary_mcp/workflows/article_summary.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/summary_mcp/workflows/article_summary.py b/src/summary_mcp/workflows/article_summary.py index 4670032..0183d95 100644 --- a/src/summary_mcp/workflows/article_summary.py +++ b/src/summary_mcp/workflows/article_summary.py @@ -111,8 +111,22 @@ def _iter_selected_items( yield item_id, item return + # Format 3: single-item extracted file produced by run_freshrss_pipeline debug mode. + # Shape: {"success": bool, "article": {"item_id": "...", ...}, "warnings": [...]} + article = extracted_payload.get("article") + if isinstance(article, Mapping): + raw_item_id = article.get("item_id") + item_id = str(raw_item_id) if raw_item_id is not None else None + if item_id and (not selected_ids or item_id in selected_set): + yield item_id, { + "item": {}, + "extraction": extracted_payload, + } + return + raise RuntimeError( - "Extracted payload does not contain a supported article items structure (expected 'results' or 'items').", + "Extracted payload does not contain a supported article items structure " + "(expected 'results', 'items', or single-item format with 'article').", )