Skip to content

AI chat assistant: site-aware conversational guide #1

Description

@silverbackdan

Goal

Build an AI-powered chat assistant embedded in the docs/marketing site that can discuss CWA in a relatable, conversational way — similar to how NotebookLM works after ingesting a knowledge base.

What it should do

  • Answer questions about whether CWA is right for the user's project
  • Discuss how the module would work for their specific use case
  • Draw on both the advertising/marketing pages (about, built-for-business, etc.) and the full technical documentation
  • Help non-technical stakeholders understand the value proposition
  • Help developers understand how to approach their implementation

Knowledge sources

  • /llms-full.txt — full docs content (auto-generated, always up to date)
  • /llms.txt — structured index
  • Marketing/about page YAML content (content/*.yml)
  • Potentially the GitHub READMEs / changelogs of the API bundle and Nuxt module

Approach (from earlier design discussion)

The owner has additional context from a prior Claude session on the planned implementation approach. Key notes:

  • Embed the chat UI on the docs/marketing site (not a separate tool)
  • Ingest the full site content so the AI has CWA-specific knowledge, not just generic answers
  • The tone should be relatable and advisory, not a dry FAQ bot
  • Should handle both "is this right for me?" pre-sales questions and "how do I do X?" developer questions

Foundation already in place

  • GET /llms.txt — structured page index, auto-updated on deploy
  • GET /llms-full.txt — full concatenated docs text, auto-updated on deploy

These can be fed directly to an AI system at startup or used as retrieval context.

Approach (decided)

Retrieval + Claude Haiku 4.5, behind an /api/chat edge function. Full pricing comparison and prompt design in the comments.

  • Provider: Claude Haiku 4.5 ($0.012/turn → **$6/month** at 500 turns). Gemini 3.1 Flash-Lite is 4× cheaper ($1.55/mo) but at our traffic that gap is ~$4.50/month, and Google's model churn is faster (2.5 Flash-Lite retires Oct 2026; 3.1/3.5/3.6 already shipped) for a widget nobody is assigned to maintain. Note Haiku undercuts Gemini's Flash tiers — "Gemini is cheaper" only holds at Flash-Lite. Both vendors' paid tiers exclude training on inputs, so there is no privacy trade either way.
  • Retrieval, not full-context. llms-full.txt is ~165–190k tokens. Stuffing it costs ~$0.45 per cold prompt-cache write on a 5-min TTL, so low traffic makes it worse, not cheaper — and on Gemini it's far worse still, as context caching there bills $1.00/hour in storage ($720/month) on top. Retrieving ~8k tokens avoids the problem entirely; lexical/BM25 over our own docs needs no embeddings service.
  • NotebookLM cannot be the backend. No consumer API; the Gemini Notebook Enterprise API (v1alpha) is notebook/source management only — no query or chat endpoint. The only free NotebookLM path is publishing a public shared notebook and linking out.
  • Free tiers rejected for a public endpoint. Volume is fine at our traffic, but the Gemini free tier trains on submitted content and human reviewers may read inputs/outputs — the exposure is visitor questions, not our public docs. Groq (no retention by default, ZDR on all tiers) was viable and set aside. Being FOSS doesn't disqualify us from any free tier; commerciality was never the constraint.
  • Self-hosting costs more, not less — ~$100–300/month for a GPU VPS vs ~$6/month here, and the docs site prerenders to Vercel with nowhere to run inference. Retrieval is the only piece worth self-hosting.
  • Persona: conversational, metaphor-led for non-technical visitors, with the grounding rule split explicitly — metaphors are the model's to invent, facts are not — to stop it improvising product behaviour from other CMSs. Starter system prompt and seed metaphors in the comments.

Cost guards required regardless: cap turns and message length, rate-limit per IP, degrade to plain search when limits trip.

Next steps

  1. Decide on the AI provider / embedding approachdone, see above and the findings comment
  2. Design the chat UI component
  3. Decide where it lives — floating button on all pages, dedicated /ai page, or both
  4. Handle the marketing pages content (currently YAML, needs to be included in the knowledge base)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions