diff --git a/client/data/config.json b/client/data/config.json index 7dd019412..64ffebc40 100644 --- a/client/data/config.json +++ b/client/data/config.json @@ -7,7 +7,8 @@ "show_git": true, "systemTitle": "FastGPT", "authorText": "Made by FastGPT Team.", - "gitLoginKey": "" + "gitLoginKey": "", + "scripts": [] }, "SystemParams": { "gitLoginSecret": "", diff --git a/client/src/pages/_app.tsx b/client/src/pages/_app.tsx index 383de585c..841d74aeb 100644 --- a/client/src/pages/_app.tsx +++ b/client/src/pages/_app.tsx @@ -15,6 +15,7 @@ import { useRouter } from 'next/router'; import 'nprogress/nprogress.css'; import '@/styles/reset.scss'; +import { FeConfigsType } from '@/types'; //Binding events. Router.events.on('routeChangeStart', () => NProgress.start()); @@ -36,16 +37,16 @@ function App({ Component, pageProps }: AppProps) { const router = useRouter(); const { i18n } = useTranslation(); + const [scripts, setScripts] = useState([]); const [googleClientVerKey, setGoogleVerKey] = useState(); - const [baiduTongjiUrl, setBaiduTongjiUrl] = useState(); useEffect(() => { (async () => { const { - feConfigs: { googleClientVerKey, baiduTongjiUrl } + feConfigs: { scripts, googleClientVerKey } } = await clientInitData(); + setScripts(scripts || []); setGoogleVerKey(googleClientVerKey); - setBaiduTongjiUrl(baiduTongjiUrl); })(); }, []); @@ -68,12 +69,14 @@ function App({ Component, pageProps }: AppProps) { - {baiduTongjiUrl && } + {scripts?.map((item, i) => ( + + ))} {googleClientVerKey && ( <> )} diff --git a/client/src/types/index.d.ts b/client/src/types/index.d.ts index d040eadd3..3e930e04f 100644 --- a/client/src/types/index.d.ts +++ b/client/src/types/index.d.ts @@ -23,8 +23,8 @@ export type FeConfigsType = { authorText?: string; beianText?: string; googleClientVerKey?: string; - baiduTongjiUrl?: string; gitLoginKey?: string; + scripts?: { [key: string]: string }[]; }; export type SystemEnvType = { googleServiceVerKey?: string;