From 0884116fdc70fdcf5a3aa6da7d7ac8c4de565057 Mon Sep 17 00:00:00 2001 From: Dianjin Wang Date: Mon, 28 Sep 2026 11:02:14 +0800 Subject: [PATCH] Feature: add kapa.ai Ask AI assistant to the site Embed the kapa.ai website widget via the Docusaurus `scripts` option, adding an "Ask AI" button on every page that answers questions from the Apache Cloudberry documentation. To follow the ASF privacy policy, the widget sets no tracking cookie, uses hCaptcha instead of Google reCAPTCHA for bot protection, and shows a consent screen before the first question is sent, similar to what the Apache Doris website does. See: Issue#401 Assisted-by: Claude Code --- docusaurus.config.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 701c2922b3..d4f325aeb5 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -3,6 +3,7 @@ import type { Config } from "@docusaurus/types"; import { themes as prismThemes } from "prism-react-renderer"; import markdownExportRegistry from "./src/plugins/markdown-export/registry"; + const config: Config = { title: "Apache Cloudberry (Incubating)", tagline: "One advanced and mature open-source MPP (Massively Parallel Processing) database. Open source alternative to Greenplum Database.", @@ -69,6 +70,32 @@ const config: Config = { ], ], + // "Ask AI" assistant from kapa.ai, answering questions from the docs. + // Sources, allowed domains and the Website ID below (public, not a secret) + // are managed in the Kapa dashboard. For the ASF privacy policy the widget + // sets no tracking cookie, uses hCaptcha instead of Google reCAPTCHA, and + // asks for consent before the first question is sent. + scripts: [ + { + src: "https://widget.kapa.ai/kapa-widget.bundle.js", + "data-website-id": "9d55c09f-0362-44eb-a3bf-37ba3c12d572", + "data-project-name": "Apache Cloudberry", + "data-project-color": "#ff5900", + "data-project-logo": "https://cloudberry.apache.org/img/favicon.ico", + "data-modal-title": "Apache Cloudberry AI Assistant", + "data-modal-disclaimer": + "Answers are generated by AI from the [Apache Cloudberry documentation](https://cloudberry.apache.org/docs/) and may be inaccurate. Please verify important details against the docs.", + "data-modal-example-questions": + "How do I install Apache Cloudberry?,How is Cloudberry different from Greenplum?,How do I load data with gpfdist?", + "data-user-analytics-cookie-enabled": "false", + "data-bot-protection-mechanism": "hcaptcha", + "data-consent-required": "true", + "data-consent-screen-disclaimer": + "By clicking "I agree, let's chat", you consent to the use of the AI assistant in accordance with kapa.ai's [Privacy Policy](https://www.kapa.ai/content/privacy-policy). This service uses hCaptcha, which is subject to hCaptcha's [Privacy Policy](https://www.hcaptcha.com/privacy) and [Terms of Service](https://www.hcaptcha.com/terms).", + async: true, + }, + ], + presets: [ [ "classic",