Expand description
Free-form mention handling — “talk to the Archivist and it does the thing.”
When the bot is @mentioned with a message that is NOT a !/slash command,
this module classifies the intent (optionally via a local LLM) and maps it
to a whitelisted core action. Everything the LLM produces is validated
against a fixed whitelist before ANYTHING runs; prompt injection can only
pick from the closed action set.
LLM features are OPTIONAL: with FANFIC_ARCHIVIST_LLM_ENABLED=0 (default)
the module still handles fanfiction URLs (metadata/download/bookmark),
questions (“how do I…”) via /api/docs/ask, and everything else via a
natural-language /ask fallback — no Ollama, no latency.
Enums§
- Intent
- One parsed intent. The LLM can only produce actions in this enum.
Functions§
- cache_
key_ for - Normalize the message the way the LLM/cache sees it.
- classify
- Classify a free-form message into an intent.