Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
37a6293f
authored
Aug 05, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: config
parent
761ae74b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
68 deletions
+40
-68
admin/service/schema.js
+0
-20
client/.gitignore
+2
-2
client/data/config.json
+4
-4
client/src/hooks/useSendCode.ts
+2
-2
client/src/pages/_app.tsx
+4
-4
client/src/pages/api/openapi/text/sensitiveCheck.ts
+0
-4
client/src/pages/api/system/getInitData.ts
+3
-6
client/src/pages/index.tsx
+10
-13
client/src/service/mongo.ts
+1
-2
client/src/store/static.ts
+0
-6
client/src/types/index.d.ts
+14
-5
No files found.
admin/service/schema.js
View file @
37a6293f
...
@@ -95,27 +95,7 @@ const appSchema = new mongoose.Schema({
...
@@ -95,27 +95,7 @@ const appSchema = new mongoose.Schema({
updateTime
:
Date
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
App
=
mongoose
.
models
[
'app'
]
||
mongoose
.
model
(
'app'
,
appSchema
);
export
const
Kb
=
mongoose
.
models
[
'kb'
]
||
mongoose
.
model
(
'kb'
,
kbSchema
);
export
const
Kb
=
mongoose
.
models
[
'kb'
]
||
mongoose
.
model
(
'kb'
,
kbSchema
);
export
const
User
=
mongoose
.
models
[
'user'
]
||
mongoose
.
model
(
'user'
,
UserSchema
);
export
const
User
=
mongoose
.
models
[
'user'
]
||
mongoose
.
model
(
'user'
,
UserSchema
);
export
const
Pay
=
mongoose
.
models
[
'pay'
]
||
mongoose
.
model
(
'pay'
,
paySchema
);
export
const
Pay
=
mongoose
.
models
[
'pay'
]
||
mongoose
.
model
(
'pay'
,
paySchema
);
export
const
System
=
mongoose
.
models
[
'system'
]
||
mongoose
.
model
(
'system'
,
SystemSchema
);
client/.gitignore
View file @
37a6293f
...
@@ -29,4 +29,4 @@ platform.json
...
@@ -29,4 +29,4 @@ platform.json
testApi/
testApi/
local/
local/
.husky/
.husky/
data/config.json.local
data/*.local
\ No newline at end of file
\ No newline at end of file
client/data/config.json
View file @
37a6293f
...
@@ -5,15 +5,14 @@
...
@@ -5,15 +5,14 @@
"show_appStore"
:
false
,
"show_appStore"
:
false
,
"show_userDetail"
:
false
,
"show_userDetail"
:
false
,
"show_git"
:
true
,
"show_git"
:
true
,
"beianText"
:
""
,
"systemTitle"
:
"FastAI"
,
"systemTitle"
:
"FastAI"
,
"authorText"
:
"Made by FastAI Team."
"authorText"
:
"Made by FastAI Team."
},
},
"SystemParams"
:
{
"SystemParams"
:
{
"beianText"
:
""
,
"vectorMaxProcess"
:
15
,
"vectorMaxProcess"
:
15
,
"qaMaxProcess"
:
15
,
"qaMaxProcess"
:
15
,
"pgIvfflatProbe"
:
20
,
"pgIvfflatProbe"
:
20
"sensitiveCheck"
:
false
},
},
"ChatModels"
:
[
"ChatModels"
:
[
{
{
...
@@ -63,5 +62,6 @@
...
@@ -63,5 +62,6 @@
"name"
:
"Embedding-2"
,
"name"
:
"Embedding-2"
,
"price"
:
0.2
"price"
:
0.2
}
}
]
],
"plugins"
:
{}
}
}
client/src/hooks/useSendCode.ts
View file @
37a6293f
...
@@ -4,7 +4,7 @@ import { UserAuthTypeEnum } from '@/constants/common';
...
@@ -4,7 +4,7 @@ import { UserAuthTypeEnum } from '@/constants/common';
let
timer
:
any
;
let
timer
:
any
;
import
{
useToast
}
from
'./useToast'
;
import
{
useToast
}
from
'./useToast'
;
import
{
getClientToken
}
from
'@/utils/plugin/google'
;
import
{
getClientToken
}
from
'@/utils/plugin/google'
;
import
{
googleClientVerKey
}
from
'@/store/static'
;
import
{
feConfigs
}
from
'@/store/static'
;
export
const
useSendCode
=
()
=>
{
export
const
useSendCode
=
()
=>
{
const
{
toast
}
=
useToast
();
const
{
toast
}
=
useToast
();
...
@@ -27,7 +27,7 @@ export const useSendCode = () => {
...
@@ -27,7 +27,7 @@ export const useSendCode = () => {
await
sendAuthCode
({
await
sendAuthCode
({
username
,
username
,
type
,
type
,
googleToken
:
await
getClientToken
(
googleClientVerKey
)
googleToken
:
await
getClientToken
(
feConfigs
.
googleClientVerKey
)
});
});
setCodeCountDown
(
60
);
setCodeCountDown
(
60
);
timer
=
setInterval
(()
=>
{
timer
=
setInterval
(()
=>
{
...
...
client/src/pages/_app.tsx
View file @
37a6293f
...
@@ -37,15 +37,15 @@ function App({ Component, pageProps }: AppProps) {
...
@@ -37,15 +37,15 @@ function App({ Component, pageProps }: AppProps) {
const
{
i18n
}
=
useTranslation
();
const
{
i18n
}
=
useTranslation
();
const
[
googleClientVerKey
,
setGoogleVerKey
]
=
useState
<
string
>
();
const
[
googleClientVerKey
,
setGoogleVerKey
]
=
useState
<
string
>
();
const
[
baiduTongji
,
setBaiduTongji
]
=
useState
<
string
>
();
const
[
baiduTongji
Url
,
setBaiduTongjiUrl
]
=
useState
<
string
>
();
useEffect
(()
=>
{
useEffect
(()
=>
{
(
async
()
=>
{
(
async
()
=>
{
const
{
const
{
systemEnv
:
{
googleClientVerKey
,
baiduTongji
}
feConfigs
:
{
googleClientVerKey
,
baiduTongjiUrl
}
}
=
await
clientInitData
();
}
=
await
clientInitData
();
setGoogleVerKey
(
googleClientVerKey
);
setGoogleVerKey
(
googleClientVerKey
);
setBaiduTongji
(
baiduTongji
);
setBaiduTongji
Url
(
baiduTongjiUrl
);
})();
})();
},
[]);
},
[]);
...
@@ -69,7 +69,7 @@ function App({ Component, pageProps }: AppProps) {
...
@@ -69,7 +69,7 @@ function App({ Component, pageProps }: AppProps) {
<
Script
src=
"/js/qrcode.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/qrcode.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
{
baiduTongji
&&
<
Script
src=
{
baiduTongji
}
strategy=
"lazyOnload"
></
Script
>
}
{
baiduTongji
Url
&&
<
Script
src=
{
baiduTongjiUrl
}
strategy=
"lazyOnload"
></
Script
>
}
{
googleClientVerKey
&&
(
{
googleClientVerKey
&&
(
<>
<>
<
Script
<
Script
...
...
client/src/pages/api/openapi/text/sensitiveCheck.ts
View file @
37a6293f
...
@@ -28,10 +28,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -28,10 +28,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
}
export
async
function
sensitiveCheck
({
input
}:
Props
)
{
export
async
function
sensitiveCheck
({
input
}:
Props
)
{
if
(
!
global
.
systemEnv
.
sensitiveCheck
)
{
return
Promise
.
resolve
(
''
);
}
const
response
=
await
axios
({
const
response
=
await
axios
({
...
axiosConfig
(),
...
axiosConfig
(),
method
:
'POST'
,
method
:
'POST'
,
...
...
client/src/pages/api/system/getInitData.ts
View file @
37a6293f
import
type
{
FeConfigsType
,
SystemEnvType
}
from
'@/types'
;
import
type
{
FeConfigsType
}
from
'@/types'
;
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'next'
;
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'next'
;
import
{
jsonRes
}
from
'@/service/response'
;
import
{
jsonRes
}
from
'@/service/response'
;
import
{
readFileSync
}
from
'fs'
;
import
{
readFileSync
}
from
'fs'
;
...
@@ -12,7 +12,6 @@ export type InitDateResponse = {
...
@@ -12,7 +12,6 @@ export type InitDateResponse = {
chatModels
:
ChatModelItemType
[];
chatModels
:
ChatModelItemType
[];
qaModels
:
QAModelItemType
[];
qaModels
:
QAModelItemType
[];
vectorModels
:
VectorModelItemType
[];
vectorModels
:
VectorModelItemType
[];
systemEnv
:
SystemEnvType
;
feConfigs
:
FeConfigsType
;
feConfigs
:
FeConfigsType
;
};
};
...
@@ -22,7 +21,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -22,7 +21,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
}
jsonRes
<
InitDateResponse
>
(
res
,
{
jsonRes
<
InitDateResponse
>
(
res
,
{
data
:
{
data
:
{
systemEnv
:
global
.
systemEnv
,
feConfigs
:
global
.
feConfigs
,
feConfigs
:
global
.
feConfigs
,
chatModels
:
global
.
chatModels
,
chatModels
:
global
.
chatModels
,
qaModels
:
global
.
qaModels
,
qaModels
:
global
.
qaModels
,
...
@@ -34,8 +32,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -34,8 +32,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const
defaultSystemEnv
=
{
const
defaultSystemEnv
=
{
vectorMaxProcess
:
15
,
vectorMaxProcess
:
15
,
qaMaxProcess
:
15
,
qaMaxProcess
:
15
,
pgIvfflatProbe
:
20
,
pgIvfflatProbe
:
20
sensitiveCheck
:
false
};
};
const
defaultFeConfigs
=
{
const
defaultFeConfigs
=
{
show_emptyChat
:
true
,
show_emptyChat
:
true
,
...
@@ -102,7 +99,7 @@ export async function getInitConfig() {
...
@@ -102,7 +99,7 @@ export async function getInitConfig() {
global
.
vectorModels
=
res
.
VectorModels
||
defaultVectorModels
;
global
.
vectorModels
=
res
.
VectorModels
||
defaultVectorModels
;
}
catch
(
error
)
{
}
catch
(
error
)
{
setDefaultData
();
setDefaultData
();
console
.
log
(
'get init config error, set default'
);
console
.
log
(
'get init config error, set default'
,
error
);
}
}
}
}
...
...
client/src/pages/index.tsx
View file @
37a6293f
...
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
...
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
import
{
Card
,
Box
,
Link
,
Flex
,
Image
,
Button
}
from
'@chakra-ui/react'
;
import
{
Card
,
Box
,
Link
,
Flex
,
Image
,
Button
}
from
'@chakra-ui/react'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
beianText
}
from
'@/store/static'
;
import
{
feConfigs
}
from
'@/store/static'
;
import
{
feConfigs
}
from
'@/store/static'
;
import
{
serviceSideProps
}
from
'@/utils/i18n'
;
import
{
serviceSideProps
}
from
'@/utils/i18n'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
{
useTranslation
}
from
'next-i18next'
;
...
@@ -215,19 +214,17 @@ const Home = () => {
...
@@ -215,19 +214,17 @@ const Home = () => {
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
{
feConfigs
?.
authorText
&&
(
<
Box
w=
{
'100%'
}
mt=
{
'100vh'
}
px=
{
[
5
,
10
]
}
pb=
{
[
5
,
10
]
}
>
<
Box
w=
{
'100%'
}
mt=
{
'100vh'
}
px=
{
[
5
,
10
]
}
pb=
{
[
5
,
10
]
}
>
<
Card
p=
{
5
}
mt=
{
4
}
textAlign=
{
'center'
}
>
<
Card
p=
{
5
}
mt=
{
4
}
textAlign=
{
'center'
}
>
{
feConfigs
?.
beianText
&&
(
{
beianText
&&
(
<
Link
href=
"https://beian.miit.gov.cn/"
target=
"_blank"
>
<
Link
href=
"https://beian.miit.gov.cn/"
target=
"_blank"
>
{
feConfigs
.
beianText
}
{
beianText
}
</
Link
>
</
Link
>
)
}
)
}
<
Box
>
{
feConfigs
?.
authorText
}
</
Box
>
{
feConfigs
?.
authorText
&&
<
Box
>
{
feConfigs
?.
authorText
}
</
Box
>
}
</
Card
>
</
Card
>
</
Box
>
</
Box
>
)
}
</
Flex
>
</
Flex
>
);
);
};
};
...
...
client/src/service/mongo.ts
View file @
37a6293f
...
@@ -22,8 +22,7 @@ export async function connectToDatabase(): Promise<void> {
...
@@ -22,8 +22,7 @@ export async function connectToDatabase(): Promise<void> {
global
.
systemEnv
=
{
global
.
systemEnv
=
{
vectorMaxProcess
:
10
,
vectorMaxProcess
:
10
,
qaMaxProcess
:
10
,
qaMaxProcess
:
10
,
pgIvfflatProbe
:
10
,
pgIvfflatProbe
:
10
sensitiveCheck
:
false
};
};
global
.
sendInformQueue
=
[];
global
.
sendInformQueue
=
[];
global
.
sendInformQueueLen
=
0
;
global
.
sendInformQueueLen
=
0
;
...
...
client/src/store/static.ts
View file @
37a6293f
...
@@ -8,9 +8,6 @@ import { getInitData } from '@/api/system';
...
@@ -8,9 +8,6 @@ import { getInitData } from '@/api/system';
import
{
delay
}
from
'@/utils/tools'
;
import
{
delay
}
from
'@/utils/tools'
;
import
{
FeConfigsType
}
from
'@/types'
;
import
{
FeConfigsType
}
from
'@/types'
;
export
let
beianText
:
string
|
undefined
;
export
let
googleClientVerKey
:
string
|
undefined
;
export
let
baiduTongji
:
string
|
undefined
;
export
let
chatModelList
:
ChatModelItemType
[]
=
[];
export
let
chatModelList
:
ChatModelItemType
[]
=
[];
export
let
qaModelList
:
QAModelItemType
[]
=
[];
export
let
qaModelList
:
QAModelItemType
[]
=
[];
export
let
vectorModelList
:
VectorModelItemType
[]
=
[];
export
let
vectorModelList
:
VectorModelItemType
[]
=
[];
...
@@ -26,9 +23,6 @@ export const clientInitData = async (): Promise<InitDateResponse> => {
...
@@ -26,9 +23,6 @@ export const clientInitData = async (): Promise<InitDateResponse> => {
qaModelList
=
res
.
qaModels
;
qaModelList
=
res
.
qaModels
;
vectorModelList
=
res
.
vectorModels
;
vectorModelList
=
res
.
vectorModels
;
feConfigs
=
res
.
feConfigs
;
feConfigs
=
res
.
feConfigs
;
beianText
=
res
.
systemEnv
?.
beianText
;
googleClientVerKey
=
res
.
systemEnv
?.
googleClientVerKey
;
baiduTongji
=
res
.
systemEnv
?.
baiduTongji
;
return
res
;
return
res
;
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
client/src/types/index.d.ts
View file @
37a6293f
...
@@ -21,16 +21,23 @@ export type FeConfigsType = {
...
@@ -21,16 +21,23 @@ export type FeConfigsType = {
show_git
?:
boolean
;
show_git
?:
boolean
;
systemTitle
?:
string
;
systemTitle
?:
string
;
authorText
?:
string
;
authorText
?:
string
;
};
export
type
SystemEnvType
=
{
beianText
?:
string
;
beianText
?:
string
;
googleClientVerKey
?:
string
;
googleClientVerKey
?:
string
;
baiduTongjiUrl
?:
string
;
};
export
type
SystemEnvType
=
{
googleServiceVerKey
?:
string
;
googleServiceVerKey
?:
string
;
baiduTongji
?:
string
;
vectorMaxProcess
:
number
;
vectorMaxProcess
:
number
;
qaMaxProcess
:
number
;
qaMaxProcess
:
number
;
pgIvfflatProbe
:
number
;
pgIvfflatProbe
:
number
;
sensitiveCheck
:
boolean
;
};
type
PluginItemType
=
{
url
:
string
;
auth
:
string
;
};
export
type
PluginType
=
{
authCode
?:
PluginItemType
;
moderationsCheck
?:
PluginItemType
;
};
};
declare
global
{
declare
global
{
...
@@ -42,11 +49,13 @@ declare global {
...
@@ -42,11 +49,13 @@ declare global {
var
OpenAiEncMap
:
Tiktoken
;
var
OpenAiEncMap
:
Tiktoken
;
var
sendInformQueue
:
(()
=>
Promise
<
void
>
)[];
var
sendInformQueue
:
(()
=>
Promise
<
void
>
)[];
var
sendInformQueueLen
:
number
;
var
sendInformQueueLen
:
number
;
var
feConfigs
:
FeConfigsType
;
var
systemEnv
:
SystemEnvType
;
var
systemEnv
:
SystemEnvType
;
var
;
var
chatModels
:
ChatModelItemType
[];
var
chatModels
:
ChatModelItemType
[];
var
qaModels
:
QAModelItemType
[];
var
qaModels
:
QAModelItemType
[];
var
vectorModels
:
VectorModelItemType
[];
var
vectorModels
:
VectorModelItemType
[];
var
feConfigs
:
FeConfigsType
;
interface
Window
{
interface
Window
{
[
'pdfjs-dist/build/pdf'
]:
any
;
[
'pdfjs-dist/build/pdf'
]:
any
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment