diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 70656fa..b166d8f 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -229,6 +229,17 @@ const config: Config = { indexName: "helixbox", }, } satisfies Preset.ThemeConfig, + scripts: [ + { + src: 'js/ai.js', + async: false, + }, + { + src: 'https://dify.helix.box/embed.min.js', + async: true, + id:"50BF6mXsnaB2kVMY" + }, + ], }; export default config; diff --git a/src/theme/Layout/index.tsx b/src/theme/Layout/index.tsx deleted file mode 100644 index 77a4864..0000000 --- a/src/theme/Layout/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { type ReactNode } from 'react'; -import Layout from '@theme-original/Layout'; -import type LayoutType from '@theme/Layout'; -import type { WrapperProps } from '@docusaurus/types'; -import useIsBrowser from '@docusaurus/useIsBrowser'; - -type Props = WrapperProps; -declare global { - interface Window { - difyChatbotConfig: { - token: string; - baseUrl: string; - }; - } -} -const useScript = (url, selector = 'body', async = true) => { - React.useEffect(() => { - const element = document.querySelector(selector) - const script = document.createElement('script') - script.src = url - script.async = async - element.appendChild(script) - return () => { - element.removeChild(script) - } - }, [url]) -} - -export default function LayoutWrapper(props: Props): ReactNode { - const isBrowser = useIsBrowser(); - if (isBrowser) { - window.difyChatbotConfig = { - token: 'kx7Cpuy557gWtKXo', - baseUrl: 'https://dify-darwinia.vercel.app/', - }; - } - useScript("https://dify-darwinia.vercel.app/embed.min.js"); - // // {/* */ } - // useScript("https://static.zdassets.com/ekr/snippet.js?key=3d2e9764-aa77-4889-a192-edbc23f5b09c"); - // // {/* */ } - // useScript('//fw-cdn.com/12444885/4859742.js'); - - return ( - <> - - - ); -} diff --git a/static/js/ai.js b/static/js/ai.js new file mode 100644 index 0000000..4ddec0e --- /dev/null +++ b/static/js/ai.js @@ -0,0 +1,4 @@ +window.difyChatbotConfig = { + token: '50BF6mXsnaB2kVMY', + baseUrl: 'https://dify.helix.box/', +}; \ No newline at end of file