news-digest: real article summaries + per-desk collapse
Two upgrades to make the digest actually readable:
1) Article-grounded 2-3 sentence summaries (everywhere)
The old prompt got just the title + miniflux's content excerpt,
which for HN/Lobsters/wire feeds is barely more than the title
itself — so summaries paraphrased the title and added nothing.
Now every URL gets fetched and main-content-extracted via
trafilatura on a parallel pre-pass (10 workers, ~15s for ~50
URLs). Extracted text caches to /output/.article-cache.json with
a 7-day TTL so repeat runs in the same window don't re-pull.
Headlines also get summarized now — one batched LLM call per
category (world / local). Rendered as a paragraph below the
title with source + time on the right rail.
Prompt rewrites tell the model to pull names/numbers/places
from the body and explicitly forbid restating the title.
Result: real specifics ("71% saw no pay increase globally",
"third time in less than two weeks", "Islamabad and Moscow
intermediaries") instead of title paraphrase.
2) Per-desk collapse buttons
Chevron next to .desk-count toggles a .is-collapsed class.
Collapsed state is per-device (localStorage by section id) since
collapse is a viewing preference, not content state.
This commit is contained in:
@@ -17,12 +17,21 @@ ENV PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
# tzdata so $TZ works for cron + datetime; tini so signals propagate cleanly.
|
||||
RUN apk add --no-cache tzdata tini bash
|
||||
RUN apk add --no-cache tzdata tini bash curl
|
||||
|
||||
# fastapi + uvicorn[standard] for the web container; requests + jinja2
|
||||
# for the worker. Both shipped in both containers — neither set is
|
||||
# heavy enough to justify splitting the image.
|
||||
RUN pip install --no-cache-dir requests jinja2 'fastapi>=0.115' 'uvicorn[standard]>=0.30'
|
||||
# trafilatura: main-content extractor for the article-summary upgrade
|
||||
# (worker only — it pulls lxml + a handful of HTML utils, ~80 MB total).
|
||||
# libxml2-dev/libxslt-dev are for lxml's musl wheels. apk caches are
|
||||
# cleaned in the same RUN to keep the layer small.
|
||||
RUN apk add --no-cache --virtual .build-deps gcc musl-dev libxml2-dev libxslt-dev \
|
||||
&& apk add --no-cache libxml2 libxslt \
|
||||
&& pip install --no-cache-dir \
|
||||
requests jinja2 trafilatura \
|
||||
'fastapi>=0.115' 'uvicorn[standard]>=0.30' \
|
||||
&& apk del .build-deps
|
||||
|
||||
WORKDIR /app
|
||||
COPY digest.py /app/digest.py
|
||||
|
||||
Reference in New Issue
Block a user