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

@ -42,8 +42,8 @@ func (s *ticket17HTTPScraper) Scrape(context.Context, []string) ([]scraper.Artic
return s.articles, nil
}
return []scraper.Article{
{Title: "Less relevant title", Content: "Less relevant body", URL: "https://article-secret.invalid/less", Symbols: []string{"SPX"}},
{Title: "Selected title", Content: "Selected body", URL: "https://article-secret.invalid/selected", Symbols: []string{"SPX"}},
{Title: "Less relevant title", ContentState: scraper.ContentComplete, Content: "Less relevant body", URL: "https://article-secret.invalid/less", Symbols: []string{"SPX"}},
{Title: "Selected title", ContentState: scraper.ContentComplete, Content: "Selected body", URL: "https://article-secret.invalid/selected", Symbols: []string{"SPX"}},
}, nil
}
@ -162,7 +162,7 @@ func TestGenerationLogsSanitizedLayaFailureCause(t *testing.T) {
}
modelID := "summary-model-user-a"
key := models.SourceYahooFinance
feed := &ticket17HTTPScraper{articles: []scraper.Article{{Title: articleTitle, Content: articleBody, URL: articleURL}}}
feed := &ticket17HTTPScraper{articles: []scraper.Article{{Title: articleTitle, ContentState: scraper.ContentComplete, Content: articleBody, URL: articleURL}}}
summary := &ticket17HTTPSummary{}
repo := &ticket17HTTPRepo{input: generation.UserInput{SummaryModelID: &modelID, Language: "en", RankingMode: "title", GlobalLimit: 1, Assets: []models.UserAsset{{Name: "S&P 500", Symbol: "SPX"}}, Sources: []models.Source{{ID: "source-yahoo", Type: "yahoo", SourceKey: &key, Enabled: true, ArticleLimit: 5}}}}
uc := generation.NewUseCase(generation.Dependencies{Repository: repo, SummaryResolver: &ticket17HTTPResolver{provider: summary}, LayaRanker: ranker, Scrapers: map[string]scraper.Scraper{key: feed}})