Forum teuk.org

🌍 Mediabot v3 — `ai summary` Speaks the Channel’s Language

in Mediabot · started by TeuK · 2w ago

TeuK · 2w ago

Development chronicle — mb608 · Channel-aware AI summaries

Mediabot’s ai summary command now follows the language of the IRC room instead of always answering in English.

The change deliberately keeps the summarisation machinery itself stable: the transcript selection, time filters, nick filtering and prompt metadata stay the same. Only the requested output language and the surrounding service messages become language-aware.

No database schema change was required.


🗣️ The channel decides by default

The command now uses the same per-channel language helper already shared by other Mediabot features:

+LangFR → French
+LangES → Spanish
otherwise → main.LANG
fallback → English

So on a French room:

m ai summary today

can produce:

Resume de 42 message(s) (aujourd'hui) sur #quebec...

followed by a French summary.

An English room keeps the historical English behavior.


🎛️ Explicit overrides

The language may also be forced directly:

m ai summary today fr
m ai summary 7d 3l public lang=en
m ai summary today es teuk

Supported output languages are:

en
fr
es

The explicit lang=xx form is useful when a command contains several optional tokens and the intent should be completely unambiguous.


🎯 Nick filters remain unambiguous too

The pre-commit review caught one subtle collision.

A real IRC user can perfectly well be named:

fr
en
es
public
help

Those words are also valid command options.

So mb608 now provides an explicit nick escape:

nick=<pseudo>

For example, to summarise the user literally named fr while requesting English output:

m ai summary today lang=en nick=fr

Or to summarise that same user in French:

m ai summary today fr nick=fr

This removes the last ambiguity between option tokens and real nicknames.


đź§­ Options can still appear freely

The existing flexible parser is preserved.

For example:

m ai summary 7d 3l public lang=es SlaY

means:

period      → last 7 days
summary     → 3 lines
destination → public channel
language    → Spanish
nick filter → SlaY

Language extraction happens before positional nick parsing, so fr, en and es are not accidentally treated as ordinary nick filters.


📜 Service messages follow the output language

The language selection is not limited to Claude’s final answer.

Messages around the operation also follow it:

Summarising 12 message(s)...
Resume de 12 message(s)...
Resumiendo 12 mensaje(s)...

The same applies to period labels such as:

today
aujourd'hui
hoy

yesterday
hier
ayer

this week
cette semaine
esta semana

and parameterised forms such as “last 7 days” or elapsed time since the previous summary.


đź§  The prompt stays structurally stable

The internal summarisation prompt keeps its historical English metadata.

Conceptually, it remains:

Summarise this IRC conversation ...

and gains only the requested language instruction:

..., in French:

or:

..., in Spanish:

That keeps the existing summarisation behavior stable while controlling the language of the result.


đź§Ş Validation

Claude’s development pass completed the full suite successfully:

12111/12111 PASSED

The mb608 regression test exercises real parser combinations including:

today fr
today teuk
7d 3l public lang=es SlaY
lang=de

The final pre-commit adjustment additionally locks the explicit nickname escape:

today lang=en nick=fr
today fr nick=fr

This ensures that a nickname which happens to look like an option remains addressable.


✨ Result

ai summary now fits naturally into multilingual IRC rooms:

  • channel language by default;
  • explicit en, fr or es override;
  • translated service messages;
  • unchanged transcript/query behavior;
  • flexible option ordering;
  • explicit nick=<pseudo> escape for ambiguous nicknames;
  • English remains the safe fallback.

🏰 Final parchment

The portrait in the corridor no longer answers every Common Room in the same tongue.

It listens to the room first.

And when a student happens to be named like one of the spell’s own keywords, Mediabot now knows exactly whether you meant the language — or the student.

You must be logged in to reply.