Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9c39308
Add docs RAG ingestion pipeline for Meilisearch
Strift Nov 4, 2026
8658060
Add custom Ask AI chat widget (Vite bundle, AI SDK, Meilisearch)
Strift Nov 4, 2026
da774a8
Add expand_page chat tool and make chunks lossless
Strift Nov 4, 2026
7a8467b
checkpoint before checking out main
Strift Nov 10, 2026
318ada3
update prompt
Strift Nov 12, 2026
6653df8
Widen the Ask AI panel and list each source page once.
Strift Nov 12, 2026
0b0b713
Send the reader's code-sample language with each chat request.
Strift Nov 12, 2026
925438b
Index API routes and mounted code samples so chat can answer with req…
Strift Nov 12, 2026
116bd41
Style Ask AI code samples to match the documentation code groups.
Strift Nov 12, 2026
0b338da
Always load the docs chat and read its settings from environment vari…
Strift Nov 18, 2026
6894386
Load each docs preview's chat from that branch's Vercel deployment.
Strift Nov 18, 2026
82cf88a
Load the chat from the local dev server when previewing docs on local…
Strift Nov 18, 2026
c520905
Import the compiled samples module so the chat function can start on …
Strift Nov 18, 2026
1de7784
Make the Ask AI panel push the docs column aside so the page stays re…
Strift Nov 18, 2026
d75abb8
Let the docs chat find API routes by SDK method name and rerank a wid…
Strift Nov 18, 2026
1880770
Log a federated chat trace so search latency and relevancy can be tuned.
Strift Nov 18, 2026
adb5514
Match the Ask Meilisearch header to the docs navbar.
Strift Nov 18, 2026
5a4dc71
Cap the docs chat at two searches and run it in London so answers sta…
Strift Nov 18, 2026
61bfac2
Pin the docs chat to OpenAI so follow-ups can decrypt prior reasoning.
Strift Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ingestion (`npm run ingest`). The docs site does not read this file.
MEILISEARCH_URL=
MEILISEARCH_API_KEY=
VOYAGE_API_KEY=
# Optional. Must match the chat deployment. Defaults: docs-chunks, api-routes, voyage
MEILISEARCH_DOCS_INDEX=
MEILISEARCH_ROUTES_INDEX=
MEILISEARCH_EMBEDDER=
43 changes: 43 additions & 0 deletions .github/workflows/ingest-chat-indexes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Keeps the docs chat indexes in sync. Sync state lives in Meilisearch, so unchanged pages are skipped.
name: Ingest chat indexes

on:
workflow_dispatch:
inputs:
force:
description: Re-sync every page, even unchanged ones
type: boolean
default: false
push:
branches:
- main

jobs:
ingest:
name: Ingest docs into Meilisearch
if: github.repository == 'meilisearch/documentation'
runs-on: ubuntu-latest
concurrency:
group: ingest
cancel-in-progress: false
steps:
- uses: actions/checkout@v6

# `--env-file-if-exists` in the ingest script needs Node.js 20.12 or newer.
- uses: actions/setup-node@v7
with:
node-version: "22"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Ingest
run: npm run ingest -- ${{ github.event_name == 'workflow_dispatch' && inputs.force && '--force' || '' }}
env:
MEILISEARCH_URL: ${{ vars.CHAT_MEILISEARCH_URL }}
MEILISEARCH_API_KEY: ${{ secrets.CHAT_MEILISEARCH_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
MEILISEARCH_DOCS_INDEX: ${{ vars.MEILISEARCH_DOCS_INDEX }}
MEILISEARCH_ROUTES_INDEX: ${{ vars.MEILISEARCH_ROUTES_INDEX }}
MEILISEARCH_EMBEDDER: ${{ vars.MEILISEARCH_EMBEDDER }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ yarn-error.log

# Script output
broken-links.txt
.ingest/

# Claude Code (local only, not committed)
.claude/superpowers
Expand Down
1 change: 1 addition & 0 deletions .mintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Agent instruction files are not documentation pages.
**/AGENTS.md
chat/
53 changes: 53 additions & 0 deletions chat-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Loads the "Ask AI" chat widget (source in /chat, built with Vite and hosted on Vercel).
// Mintlify serves this file on every page; the widget itself is not part of the docs build.
//
// Mintlify cannot read Vercel's env vars. A preview hostname already ends with the branch
// slug Vercel puts in VERCEL_BRANCH_URL:
// meilisearch-6b28dec2-<branch>.mintlify.site
// -> documentation-chat-git-<branch>-meili.vercel.app
// The bundle then calls the API on the origin baked in from that env var.

const MEILI_CHAT_PROD_URL = 'https://documentation-chat.vercel.app'
// Used only when `npm run dev` is running in chat/. 127.0.0.1 avoids an IPv6-only bind.
const MEILI_CHAT_DEV_URL = 'http://127.0.0.1:5173'
const MINTLIFY_PREVIEW = /^meilisearch-6b28dec2-(.+)\.mintlify\.site$/
// DNS labels are at most 63 characters. Vercel truncates the branch alias to fit.
const BRANCH_PREFIX = 'documentation-chat-git-'
const BRANCH_SUFFIX = '-meili'

function branchChatUrl(hostname) {
const match = hostname.match(MINTLIFY_PREVIEW)
if (!match || !/^[a-z0-9-]+$/.test(match[1])) return ''
const room = 63 - BRANCH_PREFIX.length - BRANCH_SUFFIX.length
const branch = match[1].slice(0, room).replace(/-+$/, '')
if (!branch) return ''
return `https://${BRANCH_PREFIX}${branch}${BRANCH_SUFFIX}.vercel.app`
}

function loadMeilisearchChat() {
if (window.__meiliChatLoaded) {
return
}

const { hostname } = window.location
const isLocal = hostname === 'localhost' || hostname === '127.0.0.1'
// Local docs always use the chat dev server (`npm run dev` in chat/).
const base = (isLocal ? MEILI_CHAT_DEV_URL : branchChatUrl(hostname) || MEILI_CHAT_PROD_URL).replace(/\/$/, '')
window.__meiliChatLoaded = true

const script = document.createElement('script')
script.src = `${base}/chat.js`
script.async = true
script.onload = () => window.MeiliChat && window.MeiliChat.mount({ apiBase: base })
script.onerror = () => {
window.__meiliChatLoaded = false
console.warn('Meilisearch chat widget failed to load from', script.src)
}
document.head.appendChild(script)
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', loadMeilisearchChat)
} else {
loadMeilisearchChat()
}
16 changes: 16 additions & 0 deletions chat/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Required
OPENROUTER_API_KEY=
MEILISEARCH_URL=https://ms-909f535664f8-173.lon.meilisearch.io
# Search-only key with access to the docs and routes indexes
MEILISEARCH_KEY=
# Voyage key for rerank-3
VOYAGE_API_KEY=
# Optional. OpenAI models on OpenRouter. The query model only writes the search.
CHAT_MODEL=openai/gpt-6-luna
CHAT_QUERY_MODEL=openai/gpt-6-luna
# Comma-separated hostnames, "*." for subdomains. Default: meilisearch.com,*.meilisearch.com,*.mintlify.site
CHAT_ALLOWED_ORIGINS=
# Must match the ingestion run. Defaults: docs-chunks, api-routes, voyage
MEILISEARCH_DOCS_INDEX=
MEILISEARCH_ROUTES_INDEX=
MEILISEARCH_EMBEDDER=
4 changes: 4 additions & 0 deletions chat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.env.local
.vercel
Loading
Loading