Files
doge_cogs/tests/alignment_messages.py
Ziad ArafatandClaude Opus 5.5 d15e76ebd7 doge_alignment: richer guesses from conversations, activity and avatar
- Context: around a couple of their messages on each sampled page, fetch
  the channel conversation. core/conversations.py merges quick consecutive
  messages into turns, splits conversations at 20-minute lulls (replies
  stay with what they answer), trims around the person and renders
  transcripts with others as A, B, ...; people who blocked guesses are
  hidden, bots left out.
- core/activity.py: posting rate between sampled pages over the years
  and its variation, busiest UTC hours and spread, nights and weekends,
  burstiness, run length, length and style shares.
- Avatar: ImageMagick palette with colour names, and a description from
  the model's vision (Qwen3.5 has it).
- core/guess.py: dossier packed to a token budget (default 32k,
  ALIGNMENT_CONTEXT_TOKENS) round-robin across the history; page count
  follows the budget. Discord markup is tidied first: raw text ran at
  1.6 chars/token, tidied 2.4, which cut one real prompt from 34k to 14k
  tokens. New candid, debiased system prompt; temperature 0.3.
- gather.py holds the Discord fetching; the cog shows progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
2026-11-05 15:44:55 -07:00

32 lines
923 B
Python

"""Builders for chat messages in tests."""
from datetime import UTC, datetime, timedelta
from doge_alignment.core.messages import Message
START = datetime(2024, 1, 1, 12, 0, tzinfo=UTC)
def msg( # noqa: PLR0913 (a test builder)
n: int,
author: str = "me",
minutes: float = 0,
content: str = "",
channel: str = "c1",
reply_to: str | None = None,
*,
bot: bool = False,
) -> Message:
"""Return message ``n`` by ``author`` ``minutes`` after START."""
return Message(
id=str(1000 + n),
author_id=author,
author_name=author.title(),
channel_id=channel,
channel_name=f"chan-{channel}",
created=START + timedelta(minutes=minutes),
content=content or f"text {n}",
reply_to=reply_to,
bot=bot,
)