feat(summary): send complete articles within user budget (#39)

This commit is contained in:
2026-11-24 17:39:26 +01:00
parent d0c7cb7cae
commit 79953ce49f
73 changed files with 1688 additions and 288 deletions

View File

@ -2,12 +2,32 @@ package scraper
import (
"context"
"strings"
"time"
"github.com/tradarr/backend/internal/models"
)
const (
ContentComplete = "complete"
ContentIncomplete = "incomplete"
ContentUnavailable = "unavailable"
)
// ContentStatus never upgrades a teaser, truncated body or unknown extraction.
func ContentStatus(a Article) string {
if strings.TrimSpace(a.Content) == "" || strings.TrimSpace(a.Content) == strings.TrimSpace(a.Title) {
return ContentUnavailable
}
if a.ContentState == ContentComplete && !a.ContentTruncated {
return ContentComplete
}
return ContentIncomplete
}
type Article struct {
ContentState string
Source string
Title string
Content string
ContentTruncated bool
@ -22,7 +42,7 @@ type Scraper interface {
}
// ArticleEnricher is an optional, transient enrichment port. Generation calls
// it only for the bounded Bloomberg pool, never for the full collected list.
// it only after source limits, never for the full collected list.
type ArticleEnricher interface {
Enrich(context.Context, []Article) ([]Article, error)
}