feat: add freshrss openclaw pipeline and clean repo
This commit is contained in:
@@ -17,7 +17,7 @@ if str(SRC_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(SRC_ROOT))
|
||||
|
||||
from summary_mcp.core.pipeline import extract_content
|
||||
from summary_mcp.integrations.freshrss import FreshRSSClient, map_entry_to_item
|
||||
from summary_mcp.integrations.freshrss import READ_TAG, FreshRSSClient, map_entry_to_item
|
||||
from summary_mcp.models.summary_io import ExtractionInput
|
||||
|
||||
|
||||
@@ -47,6 +47,16 @@ def main() -> None:
|
||||
)
|
||||
parser.add_argument("--limit", type=int, default=5, help="Maximum number of entries to request")
|
||||
parser.add_argument("--continuation", type=str, default=None, help="Continuation token for paging")
|
||||
parser.add_argument(
|
||||
"--include-read",
|
||||
action="store_true",
|
||||
help="Do not exclude items already tagged as read.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--mark-read",
|
||||
action="store_true",
|
||||
help="Mark entries as read after successful extraction for each item.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--raw-output",
|
||||
type=Path,
|
||||
@@ -84,6 +94,7 @@ def main() -> None:
|
||||
stream_id=args.stream_id,
|
||||
limit=args.limit,
|
||||
continuation=args.continuation,
|
||||
exclude_targets=[] if args.include_read else [READ_TAG],
|
||||
)
|
||||
|
||||
entries = payload.get("items")
|
||||
@@ -93,6 +104,7 @@ def main() -> None:
|
||||
mapped_items = [map_entry_to_item(entry) for entry in entries]
|
||||
extraction_results: list[dict[str, Any]] = []
|
||||
success_count = 0
|
||||
mark_read_ids: list[str] = []
|
||||
|
||||
for item in mapped_items:
|
||||
extraction = extract_content(ExtractionInput(item=item))
|
||||
@@ -104,6 +116,8 @@ def main() -> None:
|
||||
)
|
||||
if extraction.success:
|
||||
success_count += 1
|
||||
if item.external_id:
|
||||
mark_read_ids.append(item.external_id)
|
||||
|
||||
_save_json(args.raw_output, payload)
|
||||
_save_json(args.items_output, [item.model_dump(mode="json") for item in mapped_items])
|
||||
@@ -118,10 +132,17 @@ def main() -> None:
|
||||
},
|
||||
)
|
||||
|
||||
marked_count = 0
|
||||
if args.mark_read and mark_read_ids:
|
||||
client.mark_items_as_read(auth_token=auth_token, item_ids=mark_read_ids)
|
||||
marked_count = len(mark_read_ids)
|
||||
|
||||
print(
|
||||
f"Saved {len(mapped_items)} mapped items and {success_count} successful extractions to {args.extracted_output}"
|
||||
)
|
||||
if args.mark_read:
|
||||
print(f"Marked {marked_count} FreshRSS entries as read")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user