pub async fn classify(
text: &str,
config: &Arc<BotConfig>,
cache: &PageCache,
http: &Client,
) -> (Intent, bool)Expand description
Classify a free-form message into an intent.
Order of operations:
- URL in message (fanfiction host) → Metadata/Download/Bookmark immediately (no LLM needed, deterministic).
- Cache hit → return cached intent.
- LLM enabled →
POST /api/generate(Ollama, format json) with timeout; validate against whitelist. - LLM disabled or failure → keyword heuristics, then natural-language
/askfallback handled by the caller.
Returns (Intent, cached: bool).