main
Add FIRECRAWL_API_URL / FIRECRAWL_API_KEY env config. When the URL is set, the featured-article page is scraped through Firecrawl (main content only) and the richer text replaces the short feed extract, still capped at 4000 chars. Unset URL or any scrape failure falls back to the original REST-feed extract behaviour automatically. Also wire SLOW_RETRY_MINUTES through docker-compose (was missing).
Wiki Jokes
5 jokes every day, generated by an LLM from Wikipedia's Today's Featured Article.
How it works
- A scheduled job (06:00 Europe/Copenhagen, plus immediately on cold start) fetches the day's featured article from the Wikipedia REST feed and asks any OpenAI-compatible endpoint for exactly 5 jokes as JSON.
- Jokes are stored in SQLite (
/data/jokes.db) and served instantly — no LLM call at request time. - On failure: retries every 15 min, up to 3 attempts per day. If still failing, the page keeps showing the latest batch with a "stale" note.
Run
cp .env.example .env # set OPENAI_BASE_URL / OPENAI_MODEL / OPENAI_API_KEY
docker compose up -d --build
# open http://localhost:8080
Configuration (env vars)
| Var | Default | Purpose |
|---|---|---|
OPENAI_BASE_URL |
https://api.openai.com/v1 |
OpenAI-compatible endpoint (e.g. llamaswap) |
OPENAI_MODEL |
gpt-4o-mini |
Model name |
OPENAI_API_KEY |
(empty) | Bearer token (optional for llamaswap) |
GENERATE_HOUR / GENERATE_MINUTE |
6 / 0 |
Daily generation time |
MAX_ATTEMPTS |
3 |
Retry budget per burst |
RETRY_MINUTES |
15 |
Retry interval |
SLOW_RETRY_MINUTES |
60 |
Cooldown after budget exhausted, then retries resume |
WIKIPEDIA_LANG |
en |
Wikipedia language for the feed |
FIRECRAWL_API_URL |
(empty) | Firecrawl instance URL; if set, the full featured-article page is scraped via Firecrawl for richer joke material. Unset = feed extract only (original behaviour) |
FIRECRAWL_API_KEY |
(empty) | Firecrawl bearer token (optional) |
DB_PATH |
/data/jokes.db |
SQLite location (volume-mounted) |
Endpoints
GET /— today's 5 jokes + link to the featured articleGET /trmnl.json— JSON feed for TRMNL e-ink displays (seetrmnl-plugin/)GET /health— JSON: whether today's jokes exist / retries exhausted
TRMNL e-ink feed (BYOS — no TRMNL account)
GET /trmnl.json returns the day's jokes as JSON:
{
"refresh_interval": 900,
"day": "2026-10-05",
"stale": false,
"article_title": "White-headed fruit dove",
"article_url": "https://en.wikipedia.org/...",
"jokes": [{"text": "..."}]
}
This is the data source for trmnl-jokes-server (BYOS): a small server that
renders the jokes into the 800x480 1-bit BMP the TRMNL firmware expects and
answers /api/setup + /api/display directly, so the device never talks to
the TRMNL cloud. See the trmnl-jokes-server repo README.
Optional access token: set TRMNL_TOKEN in .env; requests must then carry
?token=<token> or the header trmnl-token: <token>. Without the env var the
endpoint is open — the jokes themselves are public anyway.
Description
5 daily jokes generated from Wikipedia featured article via OpenAI-compatible endpoint
82 KiB
0 Stars
1 Watchers
0 Forks
Languages
Python
98.5%
Dockerfile
1.5%