Add the Snowplow Assistant chat drawer - #1941
jborlase-snowplow wants to merge 1 commit into
Conversation
Adds an "Ask AI" button beside the search box that opens a resizable right-side drawer answering questions from the documentation. The chat is built on the Vercel AI SDK (useChat) with AI Elements components vendored from the Console and ported to Tailwind 3.4, rendering answers with streamdown. Internal links open in the same tab and the drawer survives navigation; a single conversation is kept in sessionStorage. The widget posts to the same-origin /api/assistant/chat, served by a new Cloudflare Worker handler (worker/assistant.js) that checks method and body size, applies a 10-requests-per-minute per-IP rate limit, adds the shared secret header and forwards to the console-agent docs route. The secret is a Worker secret; nothing sensitive ships in the browser bundle. Also: Tailwind 3.3 -> 3.4, a dev-server proxy plugin for local testing, Snowplow assistant_interaction events matching the Console, the prompt form excluded from form tracking, and ARCHITECTURE, WORKFLOWS and CONTRIBUTING updated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Missing SEO metadataThe following markdown files are missing required metadata fields:
Required fieldsThe file metadata is important for SEO and marketing. All markdown files, except for those with filenames starting with
Please add the missing metadata. |
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Docs style reviewScope here is the prose in the three Markdown files this PR touches ( UI elements should be bold, not quoted
The style guide's Bold, italic, and code section says "Use bold for UI elements: buttons, page titles, tabs, menus", and "Console" takes no article
Style guide, Snowplow terminology: "Console: Capitalized, no article. Data structures in Console." Suggest "It is Console's assistant…" and "…the same schema and event specifications as Console." Use
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
documentation | e332e4e | Commit Preview URL Branch Preview URL |
Sep 14 2026, 04:45 PM |
Summary
Adds the Snowplow Assistant to the docs site: an Ask AI button beside the search box opens a resizable right-side drawer that answers questions from the documentation, with citations.
src/components/Assistant/): Vercel AI SDKuseChat+DefaultChatTransport; AI Elements components vendored from the Console intosrc/components/ai-elements/and ported to Tailwind 3.4; answers rendered withstreamdown(sanitized). Lazy-loaded on first open so docs pages do not download the chat bundle. Mounted insrc/theme/Root.jsso an open conversation survives navigating to a linked page; internal links open in the same tab. Drag the left edge to resize (380–1100 px, remembered in localStorage; arrow keys and double-click reset for accessibility). Single conversation kept insessionStorage.worker/assistant.js, wired inworker/index.jsbefore tracking):POST /api/assistant/chatonly, 128 KB body cap, 10 requests/minute per IP via the Workers rate-limiting binding, addsX-Docs-Assistant-Secret, forwards to${DOCS_ASSISTANT_AGENT_URL}/api/agent/docs/chat, streams back. Fails closed (503) if unconfigured. JSON errors carrystatusso the widget shows a countdown on 429.wrangler.jsoncgainsvars.DOCS_ASSISTANT_AGENT_URLand theASSISTANT_RATE_LIMITERbinding;wrangler^4.36 added as a devDependency..dev.vars/.wranglergitignored.tailwindcss-animate),zodbumped forai@7, a dev-server proxy plugin (ASSISTANT_PROXY_TARGET), Snowplowassistant_interactionevents matching the Console, the prompt form excluded from form tracking, Product Fruits / Qualified hidden while the drawer is open. ARCHITECTURE, WORKFLOWS and CONTRIBUTING updated.Depends on snowplow-product/console-agent
feat/docs-assistantbeing deployed first; until then the button shows but questions return "The assistant is unavailable right now".Before merging
yarn buildlocally (no build runs in CI). It passes on this branch.DOCS_ASSISTANT_SHARED_SECRETin Cloudflare (same value as the agent's SSM parameter).Test plan
yarn buildsucceeds;streamdown/shikiare not in the main bundlewrangler dev: GET → 405, unknown path → 404, 200 KB body → 413, real question streams, 11th request in a minute → 429curl -i https://docs.snowplow.io/api/assistant/chat→ 405; no/api/page views in thedocs-cloudflareappFollow-up
🤖 Generated with Claude Code