fix(summarizer): ignore future-dated rows; require a score floor for the fallback
Two leaks let low-value items reach the operator brief: - get_recent_news() only bounded the window from below, so event listings dated days ahead (wiseye.org, +3d/+6d) were re-fetched, re-graded and re-billed every interval for a week. The window is now (now - N, now]; NULL timestamps stay excluded as before. - select_graded() returned ordered[:fallback_top] with no floor, so a 15/100 event listing entered the brief as 'low'. New SUMMARY_FALLBACK_MIN_SCORE (default 40, clamped 0-100) filters the fallback set; when nothing clears it the reduce phase gets empty DATA and writes the empty-brief response. The fallback WARNING now logs the floor. Docs: .env.example and docs/news.md document the new knob and window.
This commit is contained in:
parent
2c41737d42
commit
57c0444a69
7 changed files with 311 additions and 23 deletions
11
docs/news.md
11
docs/news.md
|
|
@ -79,9 +79,11 @@ it to 0-100, and falls back to the `Importance:` label (critical 95, high 78,
|
|||
medium 50, low 22, none 5) when the line is missing or unparsable — a block is
|
||||
never dropped and the fallback count is logged per batch. Only blocks scoring
|
||||
`>= SUMMARY_MIN_SCORE` (default 60) reach the reduce prompt, best first, capped
|
||||
at `SUMMARY_TOP_N` (default 12). If nothing clears the bar the top
|
||||
`SUMMARY_FALLBACK_TOP` blocks (default 3) are used so the HUD is not blank;
|
||||
`SUMMARY_FALLBACK_TOP=0` passes an empty DATA section instead. The reduce prompt
|
||||
at `SUMMARY_TOP_N` (default 12). If nothing clears the bar, up to
|
||||
`SUMMARY_FALLBACK_TOP` blocks (default 3) scoring at least
|
||||
`SUMMARY_FALLBACK_MIN_SCORE` (default 40) are used; when none does, or when
|
||||
`SUMMARY_FALLBACK_TOP=0`, the reduce phase receives an empty DATA section and
|
||||
writes the empty-brief response instead of promoting noise. The reduce prompt
|
||||
no longer asks for filler: it leads with the highest-scoring stories and never
|
||||
promotes an item above its score. Every graded article is persisted to
|
||||
`article_scores` (score, category, selected, model, summary_id) so the operator
|
||||
|
|
@ -267,7 +269,8 @@ map. `summary_en` lands in `article_summaries.summary_text`.
|
|||
| `SUMMARY_MIN_SCORE` | `60` | Map-phase score a block must reach to enter the reduce brief. |
|
||||
| `SUMMARY_TOP_N` | `12` | Max blocks passed to the reduce phase (best score first). |
|
||||
| `SUMMARY_FALLBACK_TOP` | `3` | Blocks used when nothing clears `SUMMARY_MIN_SCORE`; `0` = empty DATA. |
|
||||
| `SUMMARY_WINDOW_MINUTES` | `15` | How far back the summarizer looks for new articles. |
|
||||
| `SUMMARY_FALLBACK_MIN_SCORE` | `40` | Score floor for the fallback set; below it the reduce phase gets empty DATA. |
|
||||
| `SUMMARY_WINDOW_MINUTES` | `15` | How far back the summarizer looks for new articles (window is `(now - N, now]`; future-dated rows are ignored). |
|
||||
| `NEWS_SCRAPE_INTERVAL_S` | `10` | Pause after each crawl before the next (scraper is otherwise continuous). |
|
||||
| `NEWS_SUMMARIZE_INTERVAL_S` | `900` | Seconds between analyst runs (default 15 min). |
|
||||
| `TZ` | `America/New_York` | Timezone for the 23:00 daily recap. |
|
||||
|
|
|
|||
Loading…
Reference in a new issue