diff --git a/backend/app/pipeline.py b/backend/app/pipeline.py index 9cd9059..1ae1ff6 100644 --- a/backend/app/pipeline.py +++ b/backend/app/pipeline.py @@ -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"✂️ Qualitätsprüfung nicht bestanden\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) diff --git a/backend/app/telegram_bot.py b/backend/app/telegram_bot.py index c92b009..880a49d 100644 --- a/backend/app/telegram_bot.py +++ b/backend/app/telegram_bot.py @@ -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: