fix(reader): include all keep candidates in digest brief

This commit is contained in:
root
2026-04-14 10:10:25 +08:00
parent 416414ae1d
commit 6705613aa4
+4 -3
View File
@@ -11,7 +11,7 @@ from pydantic import BaseModel, Field
from .article_candidate import OpenClawCandidateInput
DIGEST_BRIEF_LIMIT = 5
DIGEST_BRIEF_LIMIT: int | None = None
DIGEST_BRIEF_HIGHLIGHT_LIMIT = 3
@@ -81,11 +81,12 @@ def build_openclaw_delivery_payload(
def build_openclaw_digest_brief(
payload: OpenClawDeliveryPayload,
*,
limit: int = DIGEST_BRIEF_LIMIT,
limit: int | None = DIGEST_BRIEF_LIMIT,
highlight_limit: int = DIGEST_BRIEF_HIGHLIGHT_LIMIT,
) -> OpenClawDigestBrief:
keep_candidates = [candidate for candidate in payload.candidates if candidate.selection_decision == "keep"]
sorted_candidates = sorted(keep_candidates, key=lambda candidate: candidate.digest_rank, reverse=True)
selected_candidates = sorted_candidates if limit is None else sorted_candidates[:limit]
top_candidates = [
DigestBriefCandidate(
title=candidate.title,
@@ -97,7 +98,7 @@ def build_openclaw_digest_brief(
selection_decision=candidate.selection_decision,
url=str(candidate.url),
)
for candidate in sorted_candidates[:limit]
for candidate in selected_candidates
]
return OpenClawDigestBrief(
schema_version="digest-brief.v1",