Organize knowledge into categories, set AI retrieval weights, and configure visibility.
Categories (knowledge_categories) structure your documents and FAQs into logical domains such as *Pricing & Fees*, *Clinical Guidelines*, *Staff Bios*, or *Office Policies*.
Attributes:
- name & slug: Human-readable title and URL-safe identifier.
- description: Summary of what knowledge belongs here.
- icon & color: Visual tags for the dashboard UI.
- parentId: Supports nesting child categories under parent groups.
Each category defines an aiWeight attribute that influences RAG retrieval ranking:
- Low: Supplementary background information. Retrieved only when no stronger matches exist.
- Normal (Default): Standard retrieval weighting for general documentation.
- High: Critical policy rules (e.g., cancellation penalties or medical intake prerequisites) prioritized during retrieval.
The database supports three visibility settings (category_visibility enum):
- public: Accessible by customer-facing AI channels (voice calls, website widget, WhatsApp).
- internal: Accessible only in staff dashboard searches; excluded from public customer replies.
- ai_only: Injected into the AI prompt for reasoning but hidden from public search views.
Use server actions in src/server/actions/knowledge.ts:
- createKnowledgeCategoryAction: Add new categories with custom AI instructions.
- updateKnowledgeCategoryAction: Update name, weight, or visibility.
- deleteKnowledgeCategoryAction: Safely remove empty categories.
- archiveKnowledgeCategoryAction: Soft-archive categories without deleting underlying documents.