This is an automated email from the ASF dual-hosted git repository. critas pushed a commit to branch wx_kapa_ai in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git
commit 316434c26f85fabad23d3925faca1cab8baef49e Author: CritasWang <[email protected]> AuthorDate: Tue Jan 6 16:09:43 2026 +0800 custom ai button style --- .github/workflows/site-build.yaml | 13 +++++- src/.vuepress/client.ts | 2 + src/.vuepress/components/AIButton.vue | 43 ++++++++++++++++++++ src/.vuepress/config.ts | 76 ++++++++++++++++------------------- src/.vuepress/public/.htaccess | 2 +- src/.vuepress/theme.ts | 2 +- 6 files changed, 93 insertions(+), 45 deletions(-) diff --git a/.github/workflows/site-build.yaml b/.github/workflows/site-build.yaml index 9b27734b..688deab6 100644 --- a/.github/workflows/site-build.yaml +++ b/.github/workflows/site-build.yaml @@ -37,7 +37,16 @@ jobs: env: NODE_OPTIONS: --max_old_space_size=8192 run: pnpm build - + + - name: Deploy staging website + env: + IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }} + run: | + git config --global url."https://asf-ci-deploy:[email protected]/apache/".insteadOf "https://github.com/apache/" + git config --global user.name github-actions + git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com + npm run deploy:staging + linksCheck: runs-on: ubuntu-latest if: github.event_name == 'pull_request' @@ -59,7 +68,7 @@ jobs: - name: Test build website env: NODE_OPTIONS: --max_old_space_size=8192 - run: pnpm run check-links + run: pnpm run check-links deploy: runs-on: ubuntu-latest diff --git a/src/.vuepress/client.ts b/src/.vuepress/client.ts index 9349d09b..69dd8a27 100644 --- a/src/.vuepress/client.ts +++ b/src/.vuepress/client.ts @@ -26,12 +26,14 @@ import { } from 'vuepress/client'; import useLegacyRoute from './composables/useLegacyRoute.js'; import DocSearch from './components/DocSearch.vue'; +import AIButton from './components/AIButton.vue'; import Layout from './components/SidebarLayout.vue'; import { getDocVersion } from './utils/index.js'; export default defineClientConfig({ enhance: ({ app }) => { app.component('DocSearch', DocSearch); + app.component('AIButton', AIButton); }, setup() { useLegacyRoute(); diff --git a/src/.vuepress/components/AIButton.vue b/src/.vuepress/components/AIButton.vue new file mode 100644 index 00000000..aa0ce1a1 --- /dev/null +++ b/src/.vuepress/components/AIButton.vue @@ -0,0 +1,43 @@ +<template> + <div> + <button id="custom-ask-ai-button"> + ✨ Ask AI + </button> + </div> +</template> +<style lang="scss"> +#custom-ask-ai-button { + background-color: transparent; + border: 1px solid #9E2878; + color: #9E2878; + padding: 8px 16px; + border-radius: 8px; + font-size: 14px; + cursor: pointer; + transition: all 0.3s ease; + + &:hover { + background-color: #9E2878; + color: #FFFFFF; + } +} + +.AI-Button { + margin-left: 0; + border-radius: 8px; + all: unset; + align-items: center; + background-color: var(--docsearch-searchbox-background); + border: 1px solid var(--docsearch-subtle-color); + border-radius: 4px; + color: var(--docsearch-muted-color); + cursor: pointer; + display: flex; + height: 36px; + justify-content: space-between; + padding: 0 8px; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +</style> \ No newline at end of file diff --git a/src/.vuepress/config.ts b/src/.vuepress/config.ts index 4184bccb..21911388 100644 --- a/src/.vuepress/config.ts +++ b/src/.vuepress/config.ts @@ -84,47 +84,41 @@ _paq.push(['enableLinkTracking']); })(); `, ], - // [ - // 'script', - // { - // async: true, - // src: 'https://widget.kapa.ai/kapa-widget.bundle.js', - // 'data-website-id': '2d37bfdd-8d98-40ba-9223-9d4f81bfb327', - // // 'data-language': 'zh', - // 'data-project-name': 'Apache IoTDB', - // 'data-project-color': '#9E2878', - // 'data-button-image-height': '0px', - // 'data-button-image-width': '0px', - // // 'data-button-bg-color': '#FFF', - // // 'data-button-text-color': '#9E2878', - // 'data-project-logo': 'https://iotdb.apache.org/slogo.png', - // 'data-button-position-right': '16px', - // 'data-button-position-bottom': '120px', - // 'data-button-height': '50px', - // 'data-button-width': '50px', - // 'data-button-text': 'Ask', - // 'data-modal-image-width': '150px', - // 'data-modal-title': 'AI Docs', - // // 'data-modal-disclaimer': - // // 'This is a custom LLM with access to all [Kapa documentation](https://docs.kapa.ai).', - // // 'data-modal-example-questions': - // // 'How do I get started?,How to add example questions?', - // 'data-user-analytics-fingerprint-enabled': 'true', - // // 'data-modal-x-offset': '0', - // // 'data-modal-y-offset': '0', - // // 'data-modal-with-overlay': 'false', - // // 'data-modal-inner-flex-direction': 'column', - // // 'data-modal-inner-justify-content': 'end', - // // 'data-modal-inner-max-width': '500px', - // // 'data-modal-inner-position-left': 'auto', - // // 'data-modal-inner-position-right': '0', - // // 'data-modal-inner-position-bottom': '0', - // // 'data-modal-inner-position-top': '0', - // // 'data-modal-size': '100vh', - // // 'data-modal-lock-scroll': 'false', - // // 'data-modal-header-bg-color': '#fff', - // }, - // ], + [ + 'script', + { + async: true, + src: 'https://widget.kapa.ai/kapa-widget.bundle.js', + 'data-website-id': '2d37bfdd-8d98-40ba-9223-9d4f81bfb327', + // 'data-language': 'zh', + 'data-project-name': 'Apache IoTDB', + 'data-project-color': '#FFFFFF', + 'data-button-z-index': '1999', + 'data-button-padding': '2px', + 'data-button-image-height': '24px', + 'data-button-image-width': '20px', + 'data-button-text-color': '#9E2878', + 'data-project-logo': 'https://iotdb.apache.org/img/logo.svg', + 'data-button-position-right': '16px', + 'data-button-position-bottom': '8px', + 'data-button-height': '50px', + 'data-button-width': '50px', + 'data-button-text': 'Ask', + 'data-modal-override-open-selector': '#custom-ask-ai-button', + 'data-modal-image-width': '150px', + 'data-modal-title': 'AI Docs', + 'data-modal-title-color': '#9E2878', + 'data-modal-disclaimer': + '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 bot [...] + + // 'data-modal-example-questions': + // 'How do I get started?,How to add example questions?', + 'data-user-analytics-fingerprint-enabled': 'true', + '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 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.", + }, + ], ], shouldPrefetch: false, diff --git a/src/.vuepress/public/.htaccess b/src/.vuepress/public/.htaccess index b6c11b98..fb64fb8a 100644 --- a/src/.vuepress/public/.htaccess +++ b/src/.vuepress/public/.htaccess @@ -6,4 +6,4 @@ RewriteRule . /404.html [L] ErrorDocument 404 /404.html -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:;" \ No newline at end of file +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'" diff --git a/src/.vuepress/theme.ts b/src/.vuepress/theme.ts index 1560344f..310fd24d 100644 --- a/src/.vuepress/theme.ts +++ b/src/.vuepress/theme.ts @@ -38,7 +38,7 @@ export default hopeTheme( navbarLayout: { start: ['Brand'], center: [], - end: ['DocSearch', 'Links', 'Language', 'Outlook', 'Repo'], + end: ['AIButton', 'DocSearch', 'Links', 'Language', 'Outlook', 'Repo'], }, toc: { levels: [2, 3],
