feat: 23:00 daily news recap; prompts drop futures
Summarizer still runs the 15-min analyst, plus a 24h breaking-news recap at 23:00 America/New_York. HUD pins kind=daily_recap. Prompts ignore futures/market tape.
This commit is contained in:
parent
d25ca8ed9c
commit
49ee5fe7a3
16 changed files with 431 additions and 75 deletions
|
|
@ -1220,22 +1220,31 @@ async def list_news_summaries(
|
|||
None,
|
||||
description="Only summaries generated at/after this UTC instant.",
|
||||
),
|
||||
kind: str | None = Query(
|
||||
None,
|
||||
description="Filter: interval or daily_recap. Omit for all.",
|
||||
),
|
||||
limit: int = Query(20, ge=1, le=100),
|
||||
offset: int = Query(0, ge=0),
|
||||
):
|
||||
"""Most recent master LLM summaries (newest first)."""
|
||||
if kind is not None and kind not in ("interval", "daily_recap"):
|
||||
raise HTTPException(422, "kind must be interval or daily_recap")
|
||||
async with async_session() as session:
|
||||
stmt = select(article_summaries).order_by(
|
||||
article_summaries.c.batch_timestamp.desc().nullslast()
|
||||
)
|
||||
if since:
|
||||
stmt = stmt.where(article_summaries.c.batch_timestamp >= since)
|
||||
if kind is not None:
|
||||
stmt = stmt.where(article_summaries.c.kind == kind)
|
||||
stmt = stmt.limit(limit).offset(offset)
|
||||
rows = (await session.execute(stmt)).mappings().all()
|
||||
return [
|
||||
NewsSummaryOut(
|
||||
id=r["id"], summary_text=r["summary_text"],
|
||||
batch_timestamp=r["batch_timestamp"], model=r["model"],
|
||||
kind=r["kind"],
|
||||
)
|
||||
for r in rows
|
||||
]
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ article_summaries = Table(
|
|||
Column("batch_timestamp", DateTime(timezone=True),
|
||||
server_default=func.now(), nullable=False),
|
||||
Column("model", Text), # LLM id used for this batch; nullable for old rows
|
||||
Column("kind", Text), # interval | daily_recap; nullable for old rows
|
||||
)
|
||||
|
||||
Index("ix_article_summaries_batch_timestamp", article_summaries.c.batch_timestamp)
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ class NewsSummaryOut(BaseModel):
|
|||
summary_text: str
|
||||
batch_timestamp: datetime
|
||||
model: Optional[str] = None
|
||||
kind: Optional[str] = None
|
||||
|
||||
|
||||
class NewsTickerItemOut(BaseModel):
|
||||
|
|
|
|||
|
|
@ -1350,15 +1350,18 @@ async function loadNews(force) {
|
|||
if (upd) upd.textContent = 'updating…';
|
||||
let articles = [];
|
||||
let summaries = [];
|
||||
let recaps = [];
|
||||
let tickerItems = [];
|
||||
try {
|
||||
const [rArticles, rSumm, rTick] = await Promise.all([
|
||||
const [rArticles, rSumm, rRecap, rTick] = await Promise.all([
|
||||
fetch(`${API}/api/news?limit=100`),
|
||||
fetch(`${API}/api/news/summaries?limit=1`),
|
||||
fetch(`${API}/api/news/summaries?kind=daily_recap&limit=1`),
|
||||
fetch(`${API}/api/news/ticker?limit=20`),
|
||||
]);
|
||||
if (rArticles.ok) articles = await rArticles.json();
|
||||
if (rSumm.ok) summaries = await rSumm.json();
|
||||
if (rRecap.ok) recaps = await rRecap.json();
|
||||
if (rTick.ok) tickerItems = await rTick.json();
|
||||
} catch (e) {
|
||||
const list = document.getElementById('news-list');
|
||||
|
|
@ -1369,7 +1372,7 @@ async function loadNews(force) {
|
|||
console.error('News load failed', e);
|
||||
return;
|
||||
}
|
||||
renderNewsSummary(summaries);
|
||||
renderNewsSummary(recaps.length ? recaps : summaries, recaps.length > 0);
|
||||
renderNewsList(articles);
|
||||
renderNewsTicker(articles, summaries, tickerItems);
|
||||
if (upd) upd.textContent = 'updated ' + new Date().toLocaleTimeString();
|
||||
|
|
@ -1377,7 +1380,7 @@ async function loadNews(force) {
|
|||
newsInterval = setInterval(() => loadNews(false), NEWS_REFRESH_MS);
|
||||
}
|
||||
}
|
||||
function renderNewsSummary(summaries) {
|
||||
function renderNewsSummary(summaries, isRecap) {
|
||||
const bodyEl = document.getElementById('ns-body');
|
||||
const timeEl = document.getElementById('ns-time');
|
||||
const badgeEl = document.getElementById('ns-badge');
|
||||
|
|
@ -1389,7 +1392,7 @@ function renderNewsSummary(summaries) {
|
|||
return;
|
||||
}
|
||||
const s = summaries[0];
|
||||
badgeEl.textContent = 'LATEST';
|
||||
badgeEl.textContent = isRecap || s.kind === 'daily_recap' ? 'DAILY RECAP' : 'LATEST';
|
||||
timeEl.textContent = s.batch_timestamp ? 'Batch: ' + new Date(s.batch_timestamp).toLocaleString() : '—';
|
||||
bodyEl.innerHTML = newsSimpleMD(s.summary_text || '');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue