Small joys: Quote of the Day + Word of the Day engines
- quote.py: curated public-domain quote pool (16 seeded, admin-grows), deterministic daily
pick, lazy AI "what it means" explainer of the real quote (cached). No LLM-invented quotes.
- wotd.py: LLM proposes positive words → validated/enriched against dictionaryapi.dev (real
definition, IPA, examples, audio) → audio clip cached to our origin (TTS fallback) →
deterministic daily pick. Tops the pool up toward 30/day.
- db.py: quote_pool/daily_quote + wotd_pool/daily_wotd tables.
- api.py: /api/quote/today, /api/word/today, /api/word/audio/{word} (GET+HEAD).
- cli.py: cycle steps for both (under --no-joys), shared LLM client.
- tests: test_quote.py (6) + test_wotd.py (5). 393 backend tests green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+15
-3
@@ -13,7 +13,7 @@ from .games import generate_daily_puzzles
|
||||
from .localtime import local_today
|
||||
from .dedup import DEFAULT_THRESHOLD, DEFAULT_WINDOW_DAYS, cluster_duplicates, dedup as run_dedup
|
||||
from .geo import tag_articles as tag_geo
|
||||
from . import art, onthisday
|
||||
from . import art, onthisday, quote, wotd
|
||||
from .enrich import enrich_brief_images, enrich_recent_images, enrich_summarized_images
|
||||
from .summarize import generate_summary, get_summary
|
||||
from .feeds import (
|
||||
@@ -561,13 +561,25 @@ def _run_cycle_locked(conn: sqlite3.Connection, args: argparse.Namespace) -> Non
|
||||
except Exception as exc:
|
||||
print(f"art: skipped ({exc})")
|
||||
|
||||
# On This Day: harvest + tone-filter today's date in history, then pick one good fact.
|
||||
# Small joys: On This Day (history), Quote of the Day, Word of the Day. Each is
|
||||
# bounded + non-fatal; one shared LLM client for tone/explainer/word proposals.
|
||||
if not args.no_joys:
|
||||
joy_client = LocalModelClient.from_env()
|
||||
try:
|
||||
o = onthisday.run_daily(conn, client=LocalModelClient.from_env())
|
||||
o = onthisday.run_daily(conn, client=joy_client)
|
||||
print(f"onthisday: md={o['md']} picked={'yes' if o['picked'] else 'no'}")
|
||||
except Exception as exc:
|
||||
print(f"onthisday: skipped ({exc})")
|
||||
try:
|
||||
q = quote.run_daily(conn, client=joy_client)
|
||||
print(f"quote: pool={q['pool']} picked={q['picked']}")
|
||||
except Exception as exc:
|
||||
print(f"quote: skipped ({exc})")
|
||||
try:
|
||||
w = wotd.run_daily(conn, client=joy_client)
|
||||
print(f"word: pool={w['pool']} picked={w['picked']}")
|
||||
except Exception as exc:
|
||||
print(f"word: skipped ({exc})")
|
||||
|
||||
if not args.no_brief:
|
||||
today = local_today()
|
||||
|
||||
Reference in New Issue
Block a user