From 37a6293f5e10c05bf3eccde2b9c00e355877ea3f Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Sat, 5 Aug 2023 11:51:40 +0800 Subject: [PATCH] fix: config --- admin/service/schema.js | 20 ---------------- client/.gitignore | 2 +- client/data/config.json | 8 +++---- client/src/hooks/useSendCode.ts | 4 ++-- client/src/pages/_app.tsx | 8 +++---- .../pages/api/openapi/text/sensitiveCheck.ts | 4 ---- client/src/pages/api/system/getInitData.ts | 9 +++----- client/src/pages/index.tsx | 23 ++++++++----------- client/src/service/mongo.ts | 3 +-- client/src/store/static.ts | 6 ----- client/src/types/index.d.ts | 19 +++++++++++---- 11 files changed, 39 insertions(+), 67 deletions(-) diff --git a/admin/service/schema.js b/admin/service/schema.js index edeac05ef..20b6da864 100644 --- a/admin/service/schema.js +++ b/admin/service/schema.js @@ -95,27 +95,7 @@ const appSchema = new mongoose.Schema({ updateTime: Date }); -const SystemSchema = new mongoose.Schema({ - vectorMaxProcess: { - type: Number, - default: 10 - }, - qaMaxProcess: { - type: Number, - default: 10 - }, - pgIvfflatProbe: { - type: Number, - default: 10 - }, - sensitiveCheck: { - type: Boolean, - default: false - } -}); - export const App = mongoose.models['app'] || mongoose.model('app', appSchema); export const Kb = mongoose.models['kb'] || mongoose.model('kb', kbSchema); export const User = mongoose.models['user'] || mongoose.model('user', UserSchema); export const Pay = mongoose.models['pay'] || mongoose.model('pay', paySchema); -export const System = mongoose.models['system'] || mongoose.model('system', SystemSchema); diff --git a/client/.gitignore b/client/.gitignore index f65f54be0..51d4b9a6f 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -29,4 +29,4 @@ platform.json testApi/ local/ .husky/ -data/config.json.local \ No newline at end of file +data/*.local \ No newline at end of file diff --git a/client/data/config.json b/client/data/config.json index ae5732e5f..6a5617237 100644 --- a/client/data/config.json +++ b/client/data/config.json @@ -5,15 +5,14 @@ "show_appStore": false, "show_userDetail": false, "show_git": true, + "beianText": "", "systemTitle": "FastAI", "authorText": "Made by FastAI Team." }, "SystemParams": { - "beianText": "", "vectorMaxProcess": 15, "qaMaxProcess": 15, - "pgIvfflatProbe": 20, - "sensitiveCheck": false + "pgIvfflatProbe": 20 }, "ChatModels": [ { @@ -63,5 +62,6 @@ "name": "Embedding-2", "price": 0.2 } - ] + ], + "plugins": {} } diff --git a/client/src/hooks/useSendCode.ts b/client/src/hooks/useSendCode.ts index 8bb9de2e8..d20c2d234 100644 --- a/client/src/hooks/useSendCode.ts +++ b/client/src/hooks/useSendCode.ts @@ -4,7 +4,7 @@ import { UserAuthTypeEnum } from '@/constants/common'; let timer: any; import { useToast } from './useToast'; import { getClientToken } from '@/utils/plugin/google'; -import { googleClientVerKey } from '@/store/static'; +import { feConfigs } from '@/store/static'; export const useSendCode = () => { const { toast } = useToast(); @@ -27,7 +27,7 @@ export const useSendCode = () => { await sendAuthCode({ username, type, - googleToken: await getClientToken(googleClientVerKey) + googleToken: await getClientToken(feConfigs.googleClientVerKey) }); setCodeCountDown(60); timer = setInterval(() => { diff --git a/client/src/pages/_app.tsx b/client/src/pages/_app.tsx index ff86649bd..0131731b3 100644 --- a/client/src/pages/_app.tsx +++ b/client/src/pages/_app.tsx @@ -37,15 +37,15 @@ function App({ Component, pageProps }: AppProps) { const { i18n } = useTranslation(); const [googleClientVerKey, setGoogleVerKey] = useState(); - const [baiduTongji, setBaiduTongji] = useState(); + const [baiduTongjiUrl, setBaiduTongjiUrl] = useState(); useEffect(() => { (async () => { const { - systemEnv: { googleClientVerKey, baiduTongji } + feConfigs: { googleClientVerKey, baiduTongjiUrl } } = await clientInitData(); setGoogleVerKey(googleClientVerKey); - setBaiduTongji(baiduTongji); + setBaiduTongjiUrl(baiduTongjiUrl); })(); }, []); @@ -69,7 +69,7 @@ function App({ Component, pageProps }: AppProps) { - {baiduTongji && } + {baiduTongjiUrl && } {googleClientVerKey && ( <>