Skip to main content

Live Chat Assistant

BellamyBook Assistant answers product questions using your docs-app markdown and OpenAI (default gpt-4o-mini). It replaces the old n8n webhook proxy.

How it works

  1. Frontend or docs widget POST /api/live-chat/send with header X-Live-Chat-Token.
  2. API validates the token and applies IP + session rate limits.
  3. Docs are loaded from LiveChat:DocsPath, chunked, and ranked with a cheap keyword score (synonyms, light typo fix, FAQ pin — no embedding API cost). Public Q&A (founder, GitHub, contact, pricing) lives in FAQ.
  4. Top chunks + recent Redis session history are sent to OpenAI Chat Completions.
  5. Response shape: { "output": "..." } (widgets also accept message / text).

Configuration

KeyDescription
LiveChat__EnabledTurn the endpoint on/off
LiveChat__TokenShared secret with frontend / docs widgets
LiveChat__OpenAiApiKeyOpenAI API key
LiveChat__ModelDefault gpt-4o-mini
LiveChat__DocsPathFolder of docs markdown (Docker: /app/docs)
LiveChat__SessionRateLimitPerMinutePer-session Redis limit
LiveChat__DailyRequestLimitPerIpSoft daily OpenAI request cap per IP

Also keep AspNetCoreRateLimit rule post:/api/live-chat/* (15/min, 60/hour).

Client env

  • Frontend: VITE_SOCIAL_ENABLE_LIVE_CHAT, VITE_LIVE_CHAT_TOKEN
  • Docs-app build: LIVE_CHAT_ENABLED, LIVE_CHAT_API_URL, LIVE_CHAT_TOKEN

See Self-host: Live Chat.