Knowledge base & learning

RAG over published articles and turning resolved human chats into internal knowledge.

Help center vs AI

Public published articles appear in the help center (GET /public/articles). Internal published articles are hidden from the catalog but still indexed for the AI. Drafts are excluded.

Indexing

On publish/update, markdown is split into ~800-character heading-aware chunks. Chunks are embedded with Workers AI @cf/baai/bge-base-en-v1.5 (768 dims) into Vectorize index supportal-kb, with FTS5 for hybrid retrieval (RRF merge). Local dev without Vectorize uses FTS only.

AI usage

Before the first model call per user message, top-k chunks are retrieved for the tenant and inserted as context. The model also has a search_knowledge({ query }) tool for follow-up lookups.

Learning from conversations

On a resolved human-handled thread, use Turn into knowledge in the dashboard or POST /api/admin/conversations/:id/knowledge-draft. An LLM summarizes the transcript (stripping PII) into { title, body, suggestedCategoryId }. Admins edit, then save as an article with source=conversation (default visibility internal) and publish to index.

Dashboard queue

The dashboard lists conversations resolved by humans that have not yet been converted — so nothing slips through after a busy support week.