Skip to content

Commit 75dd531

Browse files
authored
Add Kapa AI widget configuration to support multi-language and user consent functionality. (#967)
1 parent 45ed6e9 commit 75dd531

File tree

1 file changed

+48
-37
lines changed

1 file changed

+48
-37
lines changed

src/.vuepress/config.ts

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,40 @@ import theme from './theme.js';
2323

2424
const dirname = getDirname(import.meta.url);
2525

26+
const kapaConfig = {
27+
async: true,
28+
src: 'https://widget.kapa.ai/kapa-widget.bundle.js',
29+
'data-website-id': '2d37bfdd-8d98-40ba-9223-9d4f81bfb327',
30+
// 'data-language': 'zh',
31+
'data-project-name': 'Apache IoTDB',
32+
'data-project-color': '#FFFFFF',
33+
'data-button-z-index': '1999',
34+
'data-button-padding': '4px',
35+
'data-button-border-radius': '4px',
36+
'data-button-image-height': '24px',
37+
'data-button-image-width': '20px',
38+
'data-button-text-color': '#9E2878',
39+
'data-project-logo': 'https://iotdb.apache.org/img/logo.svg',
40+
'data-button-position-right': '16px',
41+
'data-button-position-bottom': '8px',
42+
'data-button-height': '56px',
43+
'data-button-width': '48px',
44+
'data-button-text': 'Ask',
45+
'data-modal-override-open-selector': '#custom-ask-ai-button',
46+
'data-modal-image-width': '150px',
47+
'data-modal-title': 'AI Docs',
48+
'data-modal-title-color': '#9E2878',
49+
'data-deep-thinking-button-active-bg-color': '#F6F7F8',
50+
'data-deep-thinking-button-active-text-color': '#9E2878',
51+
'data-deep-thinking-button-active-hover-text-color': '#9E2878',
52+
'data-modal-disclaimer':
53+
'This is a custom LLM for Apache IoTDB with access to all [documentation](iotdb.apache.org/docs/), [GitHub Open Issues, PRs and READMEs](github.com/apache/iotdb).

Companies deploy assistants like this ([built by kapa.ai](https://kapa.ai)) on docs via [website widget](https://docs.kapa.ai/integrations/website-widget) (Docker, Reddit), in [support forms](https://docs.kapa.ai/integrations/support-form-deflector) for ticket deflection (Monday.com, Mapbox), or as [Slack bots](https://docs.kapa.ai/integrations/slack-bot) with private sources.',
54+
'data-user-analytics-fingerprint-enabled': 'true',
55+
'data-consent-required': 'true',
56+
'data-consent-screen-disclaimer':
57+
"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 reCAPTCHA, which requires your consent to Google's [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai's and Google's privacy policies.",
58+
};
59+
2660
export default defineUserConfig({
2761
base: '/',
2862

@@ -31,11 +65,25 @@ export default defineUserConfig({
3165
lang: 'en-US',
3266
title: 'IoTDB Website',
3367
description: 'Apache IoTDB',
68+
head: [['script', { ...kapaConfig }]],
3469
},
3570
'/zh/': {
3671
lang: 'zh-CN',
3772
title: 'IoTDB Website',
3873
description: 'Apache IoTDB',
74+
head: [
75+
[
76+
'script',
77+
{
78+
...kapaConfig,
79+
'data-language': 'zh',
80+
'data-modal-disclaimer':
81+
'这是一个针对 Apache IoTDB 的定制化大型语言模型,能够访问所有[文档](iotdb.apache.org/docs/)、[GitHub 公开问题、PR 和自述文件](github.com/apache/iotdb)。&#10;&#10;许多公司通过 [kapa.ai 构建](https://kapa.ai) 的助手部署在文档上,方式包括通过[网站小部件](https://docs.kapa.ai/integrations/website-widget)(Docker、Reddit)、在[支持表单](https://docs.kapa.ai/integrations/support-form-deflector)中进行工单偏转(Monday.com、Mapbox),或作为具有私有源的[Slack 机器人](https://docs.kapa.ai/integrations/slack-bot)。',
82+
'data-consent-screen-disclaimer':
83+
"点击<I agree, let's chat>即表示您同意按照 kapa.ai 的[隐私政策](https://www.kapa.ai/content/privacy-policy)使用 AI 助手。本服务使用 reCAPTCHA,您需要同意 Google 的[隐私政策](https://policies.google.com/privacy)和[服务条款](https://policies.google.com/terms)。继续操作即表示您明确同意 kapa.ai 和 Google 的隐私政策。",
84+
},
85+
],
86+
],
3987
},
4088
},
4189

@@ -84,43 +132,6 @@ _paq.push(['enableLinkTracking']);
84132
})();
85133
`,
86134
],
87-
[
88-
'script',
89-
{
90-
async: true,
91-
src: 'https://widget.kapa.ai/kapa-widget.bundle.js',
92-
'data-website-id': '2d37bfdd-8d98-40ba-9223-9d4f81bfb327',
93-
// 'data-language': 'zh',
94-
'data-project-name': 'Apache IoTDB',
95-
'data-project-color': '#FFFFFF',
96-
'data-button-z-index': '1999',
97-
'data-button-padding': '4px',
98-
'data-button-border-radius': '4px',
99-
'data-button-image-height': '24px',
100-
'data-button-image-width': '20px',
101-
'data-button-text-color': '#9E2878',
102-
'data-project-logo': 'https://iotdb.apache.org/img/logo.svg',
103-
'data-button-position-right': '16px',
104-
'data-button-position-bottom': '8px',
105-
'data-button-height': '56px',
106-
'data-button-width': '48px',
107-
'data-button-text': 'Ask',
108-
// 'data-button-hide': 'true',
109-
'data-modal-override-open-selector': '#custom-ask-ai-button',
110-
'data-modal-image-width': '150px',
111-
'data-modal-title': 'AI Docs',
112-
'data-modal-title-color': '#9E2878',
113-
'data-modal-disclaimer':
114-
'This is a custom LLM for Apache IoTDB with access to all [documentation](iotdb.apache.org/docs/), [GitHub Open Issues, PRs and READMEs](github.com/apache/iotdb).&#10;&#10;Companies deploy assistants like this ([built by kapa.ai](https://kapa.ai)) on docs via [website widget](https://docs.kapa.ai/integrations/website-widget) (Docker, Reddit), in [support forms](https://docs.kapa.ai/integrations/support-form-deflector) for ticket deflection (Monday.com, Mapbox), or as [Slack bots](https://docs.kapa.ai/integrations/slack-bot) with private sources.',
115-
116-
// 'data-modal-example-questions':
117-
// 'How do I get started?,How to add example questions?',
118-
'data-user-analytics-fingerprint-enabled': 'true',
119-
'data-consent-required': 'true',
120-
'data-consent-screen-disclaimer':
121-
"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 reCAPTCHA, which requires your consent to Google's [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai's and Google's privacy policies.",
122-
},
123-
],
124135
],
125136

126137
shouldPrefetch: false,

0 commit comments

Comments
 (0)