Skip to content

Commit 316434c

Browse files
committed
custom ai button style
1 parent 407013b commit 316434c

6 files changed

Lines changed: 93 additions & 45 deletions

File tree

.github/workflows/site-build.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,16 @@ jobs:
3737
env:
3838
NODE_OPTIONS: --max_old_space_size=8192
3939
run: pnpm build
40-
40+
41+
- name: Deploy staging website
42+
env:
43+
IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }}
44+
run: |
45+
git config --global url."https://asf-ci-deploy:$IOTDB_WEBSITE_BUILD@github.com/apache/".insteadOf "https://github.com/apache/"
46+
git config --global user.name github-actions
47+
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
48+
npm run deploy:staging
49+
4150
linksCheck:
4251
runs-on: ubuntu-latest
4352
if: github.event_name == 'pull_request'
@@ -59,7 +68,7 @@ jobs:
5968
- name: Test build website
6069
env:
6170
NODE_OPTIONS: --max_old_space_size=8192
62-
run: pnpm run check-links
71+
run: pnpm run check-links
6372

6473
deploy:
6574
runs-on: ubuntu-latest

src/.vuepress/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ import {
2626
} from 'vuepress/client';
2727
import useLegacyRoute from './composables/useLegacyRoute.js';
2828
import DocSearch from './components/DocSearch.vue';
29+
import AIButton from './components/AIButton.vue';
2930
import Layout from './components/SidebarLayout.vue';
3031
import { getDocVersion } from './utils/index.js';
3132

3233
export default defineClientConfig({
3334
enhance: ({ app }) => {
3435
app.component('DocSearch', DocSearch);
36+
app.component('AIButton', AIButton);
3537
},
3638
setup() {
3739
useLegacyRoute();
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<template>
2+
<div>
3+
<button id="custom-ask-ai-button">
4+
✨ Ask AI
5+
</button>
6+
</div>
7+
</template>
8+
<style lang="scss">
9+
#custom-ask-ai-button {
10+
background-color: transparent;
11+
border: 1px solid #9E2878;
12+
color: #9E2878;
13+
padding: 8px 16px;
14+
border-radius: 8px;
15+
font-size: 14px;
16+
cursor: pointer;
17+
transition: all 0.3s ease;
18+
19+
&:hover {
20+
background-color: #9E2878;
21+
color: #FFFFFF;
22+
}
23+
}
24+
25+
.AI-Button {
26+
margin-left: 0;
27+
border-radius: 8px;
28+
all: unset;
29+
align-items: center;
30+
background-color: var(--docsearch-searchbox-background);
31+
border: 1px solid var(--docsearch-subtle-color);
32+
border-radius: 4px;
33+
color: var(--docsearch-muted-color);
34+
cursor: pointer;
35+
display: flex;
36+
height: 36px;
37+
justify-content: space-between;
38+
padding: 0 8px;
39+
-webkit-user-select: none;
40+
-moz-user-select: none;
41+
user-select: none;
42+
}
43+
</style>

src/.vuepress/config.ts

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -84,47 +84,41 @@ _paq.push(['enableLinkTracking']);
8484
})();
8585
`,
8686
],
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': '#9E2878',
96-
// 'data-button-image-height': '0px',
97-
// 'data-button-image-width': '0px',
98-
// // 'data-button-bg-color': '#FFF',
99-
// // 'data-button-text-color': '#9E2878',
100-
// 'data-project-logo': 'https://iotdb.apache.org/slogo.png',
101-
// 'data-button-position-right': '16px',
102-
// 'data-button-position-bottom': '120px',
103-
// 'data-button-height': '50px',
104-
// 'data-button-width': '50px',
105-
// 'data-button-text': 'Ask',
106-
// 'data-modal-image-width': '150px',
107-
// 'data-modal-title': 'AI Docs',
108-
// // 'data-modal-disclaimer':
109-
// // 'This is a custom LLM with access to all [Kapa documentation](https://docs.kapa.ai).',
110-
// // 'data-modal-example-questions':
111-
// // 'How do I get started?,How to add example questions?',
112-
// 'data-user-analytics-fingerprint-enabled': 'true',
113-
// // 'data-modal-x-offset': '0',
114-
// // 'data-modal-y-offset': '0',
115-
// // 'data-modal-with-overlay': 'false',
116-
// // 'data-modal-inner-flex-direction': 'column',
117-
// // 'data-modal-inner-justify-content': 'end',
118-
// // 'data-modal-inner-max-width': '500px',
119-
// // 'data-modal-inner-position-left': 'auto',
120-
// // 'data-modal-inner-position-right': '0',
121-
// // 'data-modal-inner-position-bottom': '0',
122-
// // 'data-modal-inner-position-top': '0',
123-
// // 'data-modal-size': '100vh',
124-
// // 'data-modal-lock-scroll': 'false',
125-
// // 'data-modal-header-bg-color': '#fff',
126-
// },
127-
// ],
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': '2px',
98+
'data-button-image-height': '24px',
99+
'data-button-image-width': '20px',
100+
'data-button-text-color': '#9E2878',
101+
'data-project-logo': 'https://iotdb.apache.org/img/logo.svg',
102+
'data-button-position-right': '16px',
103+
'data-button-position-bottom': '8px',
104+
'data-button-height': '50px',
105+
'data-button-width': '50px',
106+
'data-button-text': 'Ask',
107+
'data-modal-override-open-selector': '#custom-ask-ai-button',
108+
'data-modal-image-width': '150px',
109+
'data-modal-title': 'AI Docs',
110+
'data-modal-title-color': '#9E2878',
111+
'data-modal-disclaimer':
112+
'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.',
113+
114+
// 'data-modal-example-questions':
115+
// 'How do I get started?,How to add example questions?',
116+
'data-user-analytics-fingerprint-enabled': 'true',
117+
'data-consent-required': 'true',
118+
'data-consent-screen-disclaimer':
119+
"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.",
120+
},
121+
],
128122
],
129123

130124
shouldPrefetch: false,

src/.vuepress/public/.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ RewriteRule . /404.html [L]
66

77
ErrorDocument 404 /404.html
88

9-
Header set Content-Security-Policy "default-src data: blob: 'self' *.apache.org *.githubusercontent.com *.github.com *.algolia.net *.algolianet.com *.kapa.ai www.google.com *.gstatic.com *.apachecon.com *.communityovercode.org 'unsafe-inline' 'unsafe-eval'; frame-src 'self' www.google.com data: blob:; frame-ancestors 'self'; worker-src 'self' data: blob:; img-src 'self' blob: data: https: *.apache.org www.apachecon.com; style-src 'self' 'unsafe-inline' data:;"
9+
Header set Content-Security-Policy "default-src data: blob: 'self' *.apache.org *.kapa.ai *.githubusercontent.com *.googleapis.com *.google.com *.run.app *.gstatic.com *.github.com https://hcaptcha.com https://*.hcaptcha.com *.algolia.net *.algolianet.com *.apachecon.com *.communityovercode.org 'unsafe-inline' 'unsafe-eval'; frame-src *; frame-ancestors 'self' *.google.com worker-src 'self' data: blob:; img-src 'self' blob: data: https:; font-src 'self'; object-src 'none'"

src/.vuepress/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default hopeTheme(
3838
navbarLayout: {
3939
start: ['Brand'],
4040
center: [],
41-
end: ['DocSearch', 'Links', 'Language', 'Outlook', 'Repo'],
41+
end: ['AIButton', 'DocSearch', 'Links', 'Language', 'Outlook', 'Repo'],
4242
},
4343
toc: {
4444
levels: [2, 3],

0 commit comments

Comments
 (0)