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
|
|
@ -68,14 +68,14 @@ def _seed_article(title: str, url: str, domain: str, ts: str, content: str = "bo
|
|||
asyncio.run(run())
|
||||
|
||||
|
||||
def _seed_summary(text: str, ts: str, model: str | None = None) -> int:
|
||||
def _seed_summary(text: str, ts: str, model: str | None = None, kind: str | None = None) -> int:
|
||||
async def run() -> int:
|
||||
conn = await asyncpg.connect(**_conn_kwargs())
|
||||
try:
|
||||
row = await conn.fetchrow(
|
||||
"INSERT INTO article_summaries (summary_text, batch_timestamp, model) "
|
||||
"VALUES ($1, $2, $3) RETURNING id",
|
||||
text, datetime.fromisoformat(ts), model,
|
||||
"INSERT INTO article_summaries (summary_text, batch_timestamp, model, kind) "
|
||||
"VALUES ($1, $2, $3, $4) RETURNING id",
|
||||
text, datetime.fromisoformat(ts), model, kind,
|
||||
)
|
||||
return int(row["id"])
|
||||
finally:
|
||||
|
|
@ -164,9 +164,21 @@ def test_api_news_summaries_contract(clean_news):
|
|||
assert isinstance(body, list)
|
||||
assert len(body) == 1
|
||||
s = body[0]
|
||||
assert set(s.keys()) == {"id", "summary_text", "batch_timestamp", "model"}
|
||||
assert set(s.keys()) == {"id", "summary_text", "batch_timestamp", "model", "kind"}
|
||||
assert s["summary_text"] == "master summary markdown…"
|
||||
assert s["batch_timestamp"].startswith("2026-08-24T18:05")
|
||||
assert s["kind"] is None
|
||||
|
||||
|
||||
@requires_db
|
||||
def test_api_news_summaries_kind_filter(clean_news):
|
||||
_seed_summary("interval brief", "2026-08-28T22:05:00+00:00", kind="interval")
|
||||
_seed_summary("daily recap", "2026-08-28T03:00:00+00:00", kind="daily_recap")
|
||||
recap = _get("/api/news/summaries?kind=daily_recap").json()
|
||||
assert len(recap) == 1
|
||||
assert recap[0]["summary_text"] == "daily recap"
|
||||
assert recap[0]["kind"] == "daily_recap"
|
||||
assert _get("/api/news/summaries?kind=nope").status_code == 422
|
||||
|
||||
|
||||
@requires_db
|
||||
|
|
|
|||
Loading…
Reference in a new issue