feat(assistant): in-channel RAG AI assistant /ask (LC-492) #489
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-492-assistant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LC-492 - In-channel AI assistant with RAG (
/ask)A first vertical slice of the "big bet" assistant:
/ask <question>in a room retrieves context and answers with the operator LLM, posting the reply as anassistantbot. Reuses the existing FTS, LLM client, bot-user, and broadcast plumbing; the new work is retrieval -> prompt orchestration, per-room enablement, and guardrails.Trigger + orchestration (
routes::assistant)/ask(shows in autocomplete/help). It runs after the normal access + posting gates intry_dispatch.db::chat::fts_room_contextpulls the top FTS-ranked messages in the room for the question, plus the room wiki + description, into a length-capped context block (authors resolved to display labels).context + question, sent via the existingcrate::llm::LlmClient::complete.assistantbot user viafinalize_message_send(so it broadcasts + carries the bot badge). The asker's question is quoted into the message (the/askitself is not echoed). On any failure nothing is posted and the error surfaces to the asker's composer.Per-room enablement + guardrails
0077addsrooms.assistant_enabled(off by default, opt-in). A switch on the room Manage page (require_can_manage, mod-log audited) toggles it, with a hint when no LLM is configured./askis gated three ways: operator LLM configured, room assistant enabled, and a per-user rate limit (RateLimitKind::AssistantAsk, 10/min). Question length is capped (1000 chars); context is capped (8000 chars).Tests
routes_assistant(mock LLM): a disabled room refuses/askand posts nothing (and does not create the bot); an enabled room posts the answer as theassistantbot, quoting the question.db_room_assistant: toggle round-trip + room-scoped FTS retrieval.just check,just test,just test-saasall green; i18n parity covers the newroom-assistant-*keys (en+es); Tailwind rebuilt.Operator note
Documented in the
LETS_CHAT_LLM_*env row (CLAUDE.md):/asksends retrieved room context + the question to the LLM endpoint. It is off by default and per-room opt-in and requires the LLM configured, so enabling the LLM does not by itself send anything new until a manager turns the assistant on. No new env var; not an operator action on upgrade.Follow-ups (not in this slice)
@assistantmention-triggering (alias for/ask), threaded replies, and citing the retrieved sources in the answer.🤖 Generated with Claude Code
POST /room/{id}/assistant (require_can_manage + mod-log audit + dual-mode response) flips rooms.assistant_enabled. The manage page shows a switch with a hint when no LLM is configured. New i18n room-assistant-* (en+es). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>