wyr/riddle: add model attribution + fix truncated WYR options
Lint / Shell (shellcheck) (push) Successful in 20s
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (ruff) (push) Successful in 5s
Lint / Secret scan (gitleaks) (push) Has been cancelled
Lint / Python deps (pip-audit) (push) Has been cancelled

wyr:
- Reject options that end on a dangling word (but/and/or/with/never etc.)
  so truncated sentences like 'but never' return None and retry
- Add 'via Llama 3.2 3B (abliterated)' credit to the poll message

riddle:
- Add 'via Llama 3.2 3B (abliterated)' credit to the riddle message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 21:57:11 -04:00
parent bc50e8205a
commit 66f761b466
+10 -5
View File
@@ -1692,10 +1692,13 @@ async def _generate_wyr() -> dict | None:
parsed = json.loads(text)
a = parsed.get("option_a", "").strip()
b = parsed.get("option_b", "").strip()
# Hard cap: truncate options that are too long
_HANGING = {"but", "and", "or", "with", "for", "in", "on", "at",
"the", "a", "an", "never", "always", "no", "not", "to",
"of", "by", "from", "that", "which", "who", "be", "have"}
if a and b:
a = " ".join(a.split()[:10])
b = " ".join(b.split()[:10])
# Reject if either option ends on a dangling word (truncation artifact)
if a.split()[-1].lower() in _HANGING or b.split()[-1].lower() in _HANGING:
return None
q = f"Would you rather {a.rstrip('.')} OR {b.rstrip('.')}?"
return {"question": q, "option_a": a, "option_b": b}
except Exception as e:
@@ -1724,7 +1727,8 @@ async def cmd_wyr(client: AsyncClient, room_id: str, sender: str, args: str):
f'<em>{wyr["question"]}</em><br><br>'
f'🅰️ <strong>{wyr["option_a"]}</strong><br>'
f'🅱️ <strong>{wyr["option_b"]}</strong><br><br>'
f'<em>React with 🅰️ or 🅱️ — results in 30 seconds!</em>'
f'<em>React with 🅰️ or 🅱️ — results in 30 seconds!</em><br>'
f'<sup><em>via {_model_label(BALL_MODEL)}</em></sup>'
)
resp = await send_html(client, room_id, plain, html)
@@ -1871,7 +1875,8 @@ async def cmd_riddle(client: AsyncClient, room_id: str, sender: str, args: str):
html = (
f'<font color="#14b8a6"><strong>🧩 Riddle!</strong></font><br>'
f'<blockquote>{riddle}</blockquote>'
f'<em>Type your answer in chat — 60 seconds on the clock!</em>'
f'<em>Type your answer in chat — 60 seconds on the clock!</em><br>'
f'<sup><em>via {_model_label(BALL_MODEL)}</em></sup>'
)
await send_html(client, room_id, plain, html)