fix(pipeline): send individual Telegram notifications for quality gate rejections
- Add individual Telegram message when an article is rejected by quality
gate (too short raw content or rewritten text), so users see each
rejection in real time instead of only in the bulk summary
- Add quality_gate_rejected counter to PipelineStats and result dict
- Show quality gate rejections separately in pipeline-done summary
(✂️ Qualitätsprüfung: N) distinct from score-based rejections
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
09dcf6ce36
commit
2d1dd14e45
2 changed files with 18 additions and 2 deletions
|
|
@ -43,6 +43,7 @@ class PipelineStats:
|
|||
processed: int = 0
|
||||
drafts_created: int = 0
|
||||
rejected: int = 0
|
||||
quality_gate_rejected: int = 0
|
||||
warnings: int = 0
|
||||
errors: int = 0
|
||||
no_image: int = 0
|
||||
|
|
@ -261,6 +262,7 @@ def run_auto_pipeline(trigger: str = "auto") -> dict[str, Any]:
|
|||
"processed": stats.processed,
|
||||
"drafts_created": stats.drafts_created,
|
||||
"rejected": stats.rejected,
|
||||
"quality_gate_rejected": stats.quality_gate_rejected,
|
||||
"no_image": stats.no_image,
|
||||
"warnings": stats.warnings,
|
||||
"errors": stats.errors,
|
||||
|
|
@ -372,8 +374,19 @@ def _process_article(article: dict[str, Any], stats: PipelineStats, settings: An
|
|||
# Release the reserved slot so it's available for the next article
|
||||
from .scheduler import release_publish_slot
|
||||
release_publish_slot(article_id)
|
||||
stats.rejected_articles.append(get_article_by_id(article_id) or {})
|
||||
stats.quality_gate_rejected += 1
|
||||
logger.info("Artikel #%d wegen Qualitätsprüfung abgelehnt: %s", article_id, exc)
|
||||
# Individual Telegram notification for quality gate rejection
|
||||
try:
|
||||
title = (article.get("title") or "Ohne Titel")[:80]
|
||||
tg.send_message(
|
||||
f"✂️ <b>Qualitätsprüfung nicht bestanden</b>\n"
|
||||
f"📰 {title}\n"
|
||||
f"💯 Score: {score}/100\n"
|
||||
f"⚠️ {exc}"
|
||||
)
|
||||
except Exception as tg_exc:
|
||||
logger.warning("Telegram QG-Benachrichtigung für #%d fehlgeschlagen: %s", article_id, tg_exc)
|
||||
|
||||
except Exception as exc:
|
||||
logger.error("Draft-Erstellung für #%d fehlgeschlagen: %s", article_id, exc)
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ def notify_pipeline_done(stats: dict[str, Any]) -> None:
|
|||
processed = stats.get("processed", 0)
|
||||
drafts = stats.get("drafts_created", 0)
|
||||
rejected = stats.get("rejected", 0)
|
||||
quality_gate_rejected = stats.get("quality_gate_rejected", 0)
|
||||
no_image = stats.get("no_image", 0)
|
||||
warnings = stats.get("warnings", 0)
|
||||
errors = stats.get("errors", 0)
|
||||
|
|
@ -300,7 +301,9 @@ def notify_pipeline_done(stats: dict[str, Any]) -> None:
|
|||
f"📝 Drafts erstellt: {drafts}",
|
||||
]
|
||||
if rejected:
|
||||
lines.append(f"🚫 Abgelehnt: {rejected}")
|
||||
lines.append(f"🚫 Abgelehnt (Score): {rejected}")
|
||||
if quality_gate_rejected:
|
||||
lines.append(f"✂️ Qualitätsprüfung: {quality_gate_rejected}")
|
||||
if no_image:
|
||||
lines.append(f"🖼️ Kein Bild: {no_image}")
|
||||
if warnings:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue