Internal • Technical Documentation
Solution architecture & build brief for the live assistant
Confidential — internal use only. This page is set to no-index and is not intended for public visitors. It is accessed from the admin dashboard area and outlines how to build the live system behind the branded Gen26Tech AI front-end.
Document type: Solution architecture & build brief • Owner: Gen26Tech (Pty) Ltd
Official channels: info@gen26tech.co.za • +27 87 149 0801 • 26connect.app
MVP goal: a functional, on-brand AI assistant that (a) answers questions from approved knowledge, (b) captures and classifies leads, (c) hands over to humans, and (d) is managed through a secure admin dashboard.
Non-goals for MVP: voice, multilingual voice, WhatsApp, sales automation, multi-agent departments (defined as Phase 2+).
Design principles: RAG-only answers (no invention), everything owned by Gen26Tech, secrets never exposed to the browser, POPIA-first, API-first so 26Connect and other apps can integrate later.
Key rule: the browser only ever talks to Gen26Tech’s own backend. The backend is the only component holding the AI provider key and the database credentials.
Client layer: website chat widget + admin dashboard UI.
API & orchestration layer: API gateway, orchestrator, auth/RBAC, lead classifier, RAG retriever.
Data layer: PostgreSQL (leads, conversations, FAQs, users), object storage (documents, attachments), vector database (embeddings).
External services: LLM provider (via secure API), email/CRM, analytics.
3.1 Chat widget: an embeddable widget (vanilla JavaScript Web Component or a thin bundle), not dependent on the page builder so it can be dropped on any Gen26Tech site. Connects to the backend over HTTPS with a short-lived widget-scoped token (never the AI provider key). Features: greeting, suggested starters, streaming replies, quick-reply chips, “talk to a human”, session continuity, consent banner. Brand tokens: background #101010, accent #C9A227, cards #141418, borders #1F1F26, body text #B8B8BD.
3.2 API gateway / backend: a single backend application (e.g., NestJS, FastAPI or Go) exposing REST/JSON. Handles authentication, rate limiting, validation, orchestration, logging and PII redaction. Stateless and horizontally scalable.
3.3 AI orchestrator: runs intent → retrieval → prompt assembly → LLM call → guardrail check → response; enforces policy and streams tokens via SSE/WebSocket.
3.4 RAG retriever + vector store: embeds the query, retrieves top-k approved chunks, passes them as grounding context; below a confidence threshold it defers to human confirmation instead of guessing.
3.5 Database: PostgreSQL with JSONB for structured plus flexible custom fields.
3.6 Object storage: S3-compatible, encrypted at rest, for uploaded documents, attachments and exports.
3.7 Admin dashboard: the previewed dashboard becomes a real, authenticated application (separate from the public site) governed by RBAC.
3.8 Integrations: transactional email now; secure 26Connect integration in Phase 2.
users — id, name, email, password_hash, role, mfa_secret, status, created_at
roles / permissions — super_admin, manager, support_agent, analyst
leads — id, conversation_id, name, business, email, phone, service_interest, budget, message, lead_type, status, consent_given, created_at
lead_types — general_enquiry, potential_customer, corporate_client, technology_partner, sponsorship, technical_support
conversations — id, session_id, visitor_hash, started_at, ended_at, channel, status, handover_at
messages — id, conversation_id, sender, content, tokens, retrieved_sources, created_at
faqs — id, question, answer, category, status, updated_by, updated_at
knowledge_docs — id, title, source_type, storage_key, status, version, approved_by, updated_at
kb_chunks — id, doc_id, chunk_text, embedding_ref, position
handovers — id, conversation_id, reason, assigned_to, created_at, resolved_at
audit_log — id, actor_id, action, entity, entity_id, meta, created_at
consent_log — id, visitor_hash, purpose, granted, timestamp
Retention: conversations and leads retained per POPIA policy (configurable, default 24 months); consent log kept as long as legally required. Deletion endpoints must cascade.
1. Ingestion: admins upload/approve documents (company overview, services, pricing sheets, 26Connect help, policies). Each doc has a status: draft → approved.
2. Chunking: split into ~300–600 token chunks with overlap; keep source metadata.
3. Embedding: generate embeddings with the chosen model; store with doc + chunk references.
4. Retrieval: embed the user question, retrieve top-k (5–8) chunks, optionally re-rank.
5. Context assembly: combine retrieved chunks + system policy + conversation history into the prompt.
6. Grounded answering: the model answers only from provided context; if insufficient, it says so and offers human handover.
7. Re-indexing: when an admin edits/approves content, that doc’s chunks are re-embedded and stale chunks removed.
Guardrail: a post-generation check compares the response against retrieved chunks and rejects unsupported claims (fallback to “requires human confirmation”).
The orchestrator prepends these rules to every request (stored centrally, editable by Super Administrator):
1. You are Gen26Tech AI, the digital business assistant of Gen26Tech (Pty) Ltd.
2. Answer only using approved knowledge provided in context; never invent prices, features or company facts.
3. Never make financial promises or guarantee earnings.
4. Never disclose confidential/internal information or admin data to visitors.
5. Distinguish Operational / In Development / Future services — never advertise unlaunched products as available.
6. If information is missing or uncertain, say so and offer a human handover.
7. Collect personal details only with explicit consent, per POPIA.
8. Maintain a professional, respectful, solution-oriented tone. Default language: English (Phase 2: multilingual).
9. Escalate unresolved or sensitive matters to a human.
1. Visitor expresses interest → assistant requests the minimum fields (name, business, email/phone, service interest, message) plus a consent checkbox.
2. Backend validates, stores the lead (status new), logs consent, and sends: an acknowledgement to the visitor (if email provided), and a notification to info@gen26tech.co.za with the classified lead summary.
3. The same pipeline tags each conversation with a lead type: general enquiry, potential customer, corporate client, technology partner, sponsorship, or technical support.
4. Assistant optionally offers to book/route (Phase 2: 26Connect meeting link).
Auth: email + password (strong hashing, e.g. Argon2id) with MFA (TOTP); short-lived JWT + refresh via secure HTTP-only cookies.
Super Administrator: all modules, users, settings, AI instructions.
Manager: leads, conversations, knowledge, reports.
Support Agent: conversations, handovers, follow-ups.
Analyst: read-only analytics.
Every sensitive action writes to the audit log. IP allow-listing and login rate limiting are recommended for the admin area.
Conversation history: searchable transcripts with filters.
Enquiry/lead management: pipeline statuses, assignment, CSV export.
FAQ management: create, edit, publish.
Knowledge base management: upload, approve, version, re-index.
AI instructions: edit system policy, tone, allowed topics.
Analytics: volume, popular topics, lead conversion, handover rate.
Company info: update details and product statuses.
Users & roles: RBAC administration.
• TLS 1.2+ everywhere; HSTS enabled.
• All secrets in a managed secret store (AWS Secrets Manager / HashiCorp Vault / Azure Key Vault) — no keys in the browser or in source control.
• Encryption at rest for database, object storage and backups.
• Input validation and output encoding; strict CORS for approved domains only.
• Rate limiting and bot protection (CAPTCHA on forms, per-IP throttles).
• Regular dependency scanning and a penetration test before go-live.
• Principle of least privilege for all service accounts.
• Lawful basis & consent captured and logged per processing purpose.
• Data minimisation — collect only what is needed.
• Right to access / deletion / correction — supported by admin actions + visitor request workflow.
• Document sub-processors (AI, email, hosting) in a processing register; prefer an acceptable hosting region.
• PII redaction in logs; avoid storing sensitive data in prompts/analytics.
• Link the existing Privacy Policy page from the widget and forms.
• Publish the Information Officer contact (legal@gen26tech.co.za).
Public / widget:
POST /api/chat/message — send message, stream reply, return conversation id
POST /api/chat/handover — request human handover
POST /api/leads — create/validate lead + consent
GET /api/chat/history/:session — session transcript (scoped token)
Admin (JWT + RBAC):
POST /api/admin/auth/login
GET /api/admin/conversations
GET /api/admin/leads (filters, pagination)
POST /api/admin/faqs / PATCH /api/admin/faqs/:id
POST /api/admin/knowledge (upload) / POST /api/admin/knowledge/:id/approve
GET /api/admin/analytics/summary
PATCH /api/admin/ai-instructions
GET /api/admin/users / PATCH /api/admin/users/:id/role
All endpoints: validation, RBAC checks, audit logging and rate limits.
• Backend: Node.js/NestJS or Python/FastAPI.
• Database: PostgreSQL + pgvector, or a dedicated vector database (Pinecone/Weaviate/Qdrant) if scale demands.
• LLM: provider-agnostic interface (OpenAI / Azure OpenAI / Anthropic / open-source), key server-side only.
• Auth: managed identity provider or self-hosted (OIDC + TOTP).
• Email: transactional provider (SES / SendGrid / Postmark).
• Hosting: containerised (Docker) on a managed cloud with autoscaling; separate dev, staging and production environments.
• CI/CD: automated tests, secret scanning, gated deploys, versioned migrations.
• dev → staging → production with isolated databases and separate secrets.
• Infrastructure-as-configuration; automated backups with tested restore.
• Staging receives a sanitised copy of knowledge (no live PII).
• Uptime and latency monitoring on API and LLM calls.
• Dashboard metrics: conversations/day, avg response time, handover rate, lead conversion, top intents, retrieval hit/miss, guardrail triggers.
• Error alerting (e.g. Sentry); structured logs with PII redaction.
• A/B hooks for prompt improvements (Phase 2).
Phase 1 — MVP (core): widget, backend, RAG over approved knowledge, lead capture + classification, email notifications, human handover, admin auth + core dashboard, POPIA consent, logging.
Phase 2 — Scale & channels: WhatsApp integration, 26Connect meeting/onboarding integration, multilingual (text), richer analytics, CRM/webhook connectors.
Phase 3 — Advanced: voice assistance, multilingual voice, AI sales automation, internal employee assistant, AI-generated business reports, multi-agent departments.
• Widget appears on all pages and returns grounded answers within ~2s.
• No invented pricing/features in a 50-question evaluation set (target ≥95% grounded).
• Lead form creates a database record + sends email within 30s.
• Handover routes to a human queue and notifies staff.
• Admin can only access permitted areas by role; all actions audited.
• Consent captured and logged; deletion request removes PII.
• Secrets never appear in the browser bundle or public source.
☐ Repositories + infrastructure owned under Gen26Tech accounts.
☐ Secret store configured; keys rotated.
☐ Knowledge base populated from approved documents.
☐ AI instructions reviewed and signed off.
☐ Roles/users provisioned; MFA enforced.
☐ Privacy Policy + POPIA register updated with sub-processors.
☐ Backups verified.
☐ Monitoring + alerting live.
This specification gives your team a complete, buildable blueprint that maps directly onto the branded pages already in place. The chat widget and dashboard simply become live once the backend described here is connected.