Files
openclaw/scripts/docs-chat
Buns Enchantress 447a3d66c0 feat: add docs chat prototype and related scripts
- Introduced a minimal documentation chatbot that builds a search index from markdown files and serves responses via an API.
- Added scripts for building the index and serving the chat API.
- Updated package.json with new commands for chat index building and serving.
- Created a new Vercel configuration file for deployment.
- Added a README for the docs chat prototype detailing usage and integration.
2026-02-03 01:09:17 -06:00
..

Docs Chat Prototype

Minimal docs chatbot that reads source docs, builds a section index, and answers questions from those excerpts via OpenAI.

Build the index

pnpm docs:chat:index

This generates scripts/docs-chat/search-index.json from docs/**/*.md.

Pipeline Integration

The docs-chat context is the generated index. CI rebuilds it whenever docs change so PRs keep scripts/docs-chat/search-index.json in sync. If you run docs publishing outside CI (for example via Mintlify), make sure the deploy pipeline also runs pnpm docs:chat:index so the chat context stays current.

Run the API

OPENAI_API_KEY=sk-... pnpm docs:chat:serve

Defaults to http://localhost:3001. Health check:

curl http://localhost:3001/health

Mintlify widget

Mintlify loads any .js in the docs content directory on every page. docs/assets/docs-chat-widget.js injects a floating “Ask Molty 🦞" button and calls the API at:

window.DOCS_CHAT_API_URL || "http://localhost:3001"

To use a deployed API, set window.DOCS_CHAT_API_URL before the widget runs (for example by adding another small .js file in docs/assets/ that sets it).