How debjoy26/text_ai_ragbot works
RAGbot is a multi-tenant website chatbot with an embeddable visitor widget, a client portal, a provider console, and a server/API plus background-worker process. The visitor flow loads the widget’s manifest and status, answers eligible FAQs locally, and otherwise creates a session and sends chat to the API. The README documents broader client onboarding, knowledge management, escalation, usage, and operational capabilities. Some server wiring and integrations are unsampled; those links are omitted rather than inferred.
Main entry points: index.ts REST and chat API · bundle.ts Widget runtime · rag.ts Retrieval and ingestion · api.ts Widget HTTP client
Components 25
Visitor widget
- Widget runtime
apps/widget/src/bundle.ts - Widget HTTP client
apps/widget/src/api.ts - FAQ matcher
apps/widget/src/matcher.ts - Answer gate
apps/widget/src/gate.ts - Chat interface
apps/widget/src/ui.ts
Server services
- REST and chat API
apps/server/src/index.ts - Authentication
apps/server/src/auth.ts - Tenant context
apps/server/src/tenant.ts - Retrieval and ingestion
apps/server/src/rag.ts - Knowledge management
apps/server/src/knowledge.ts - Client onboarding
apps/server/src/onboarding.ts - Escalation handling
apps/server/src/escalation.ts - Manifest publishing
apps/server/src/manifest.ts - Usage tracking
apps/server/src/usage.ts - Background worker
apps/server/src/worker.ts
Client portal
- Client workspace
apps/portal/src/App.tsx - Client API wrapper
apps/portal/src/api.ts
Provider console
- Provider console
apps/console/src/App.tsx - Provider API wrapper
apps/console/src/api.ts
Data and integrations
- Postgres repositories
packages/db/src/repos.ts - LLM provider layer
packages/llm/src/index.ts - Email service
packages/email/src/index.ts
Other components
- Website visitor
- Client operator
- Provider staff
Connections 24
- Website visitor → Widget runtime: loads widget
- Widget runtime → Widget HTTP client: fetches data
apps/widget/src/bundle.ts - Widget runtime → Answer gate: evaluates answers
apps/widget/src/bundle.ts - Widget runtime → Chat interface: renders chat
apps/widget/src/bundle.ts - Answer gate → FAQ matcher: matches FAQs
apps/widget/src/gate.ts - Widget HTTP client → REST and chat API: calls REST API
- Client operator → Client workspace: manages account
- Client workspace → Client API wrapper: calls client API
apps/portal/src/App.tsx - Client API wrapper → REST and chat API: calls REST API
- Provider staff → Provider console: manages service
- Provider console → Provider API wrapper: calls provider API
apps/console/src/App.tsx - Provider API wrapper → REST and chat API: calls REST API
- REST and chat API → Authentication: authenticates requests
- Authentication → Tenant context: resolves tenant
apps/server/src/auth.ts - REST and chat API → Retrieval and ingestion: handles chat and ingestion
- REST and chat API → Client onboarding: serves onboarding
- REST and chat API → Knowledge management: serves knowledge operations
- REST and chat API → Escalation handling: serves escalations
- REST and chat API → Manifest publishing: serves manifest
- REST and chat API → Usage tracking: serves usage data
- Background worker → REST and chat API: runs scheduled jobs
- Retrieval and ingestion → Postgres repositories: persists knowledge
- Retrieval and ingestion → LLM provider layer: generates answers
- Client onboarding → Email service: sends account email