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
7957f96d
authored
Jun 10, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: admin set pgIvP
parent
fb139256
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
1 deletions
+13
-1
admin/service/schema.js
+4
-0
admin/src/fields.ts
+1
-0
client/src/pages/api/openapi/kb/appKbSearch.ts
+2
-1
client/src/service/models/system.ts
+4
-0
client/src/service/mongo.ts
+1
-0
client/src/types/index.d.ts
+1
-0
No files found.
admin/service/schema.js
View file @
7957f96d
...
@@ -105,6 +105,10 @@ const SystemSchema = new mongoose.Schema({
...
@@ -105,6 +105,10 @@ const SystemSchema = new mongoose.Schema({
type
:
Number
,
type
:
Number
,
default
:
10
default
:
10
},
},
pgIvfflatProbe
:
{
type
:
Number
,
default
:
10
},
sensitiveCheck
:
{
sensitiveCheck
:
{
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
...
...
admin/src/fields.ts
View file @
7957f96d
...
@@ -45,5 +45,6 @@ export const SystemFields = [
...
@@ -45,5 +45,6 @@ export const SystemFields = [
createTextField
(
'gpt4Key'
,
{
label
:
'gpt4Key'
}),
createTextField
(
'gpt4Key'
,
{
label
:
'gpt4Key'
}),
createTextField
(
'vectorMaxProcess'
,
{
label
:
'向量最大进程'
}),
createTextField
(
'vectorMaxProcess'
,
{
label
:
'向量最大进程'
}),
createTextField
(
'qaMaxProcess'
,
{
label
:
'qa最大进程'
}),
createTextField
(
'qaMaxProcess'
,
{
label
:
'qa最大进程'
}),
createTextField
(
'pgIvfflatProbe'
,
{
label
:
'pg 探针数量'
}),
createTextField
(
'sensitiveCheck'
,
{
label
:
'敏感词校验(true,false)'
})
createTextField
(
'sensitiveCheck'
,
{
label
:
'敏感词校验(true,false)'
})
];
];
client/src/pages/api/openapi/kb/appKbSearch.ts
View file @
7957f96d
...
@@ -98,6 +98,7 @@ export async function appKbSearch({
...
@@ -98,6 +98,7 @@ export async function appKbSearch({
// search kb
// search kb
const
res
:
any
=
await
PgClient
.
query
(
const
res
:
any
=
await
PgClient
.
query
(
`BEGIN;
`BEGIN;
SET LOCAL ivfflat.probes =
${
global
.
systemEnv
.
pgIvfflatProbe
||
10
}
;
select id,q,a,source from modelData where kb_id IN (
${
model
.
chat
.
relatedKbs
select id,q,a,source from modelData where kb_id IN (
${
model
.
chat
.
relatedKbs
.
map
((
item
)
=>
`'
${
item
}
'`
)
.
map
((
item
)
=>
`'
${
item
}
'`
)
.
join
(
','
)}
) AND vector <#> '[
${
promptVector
[
0
]}
]' < -
${
similarity
}
order by vector <#> '[
${
.
join
(
','
)}
) AND vector <#> '[
${
promptVector
[
0
]}
]' < -
${
similarity
}
order by vector <#> '[
${
...
@@ -106,7 +107,7 @@ export async function appKbSearch({
...
@@ -106,7 +107,7 @@ export async function appKbSearch({
COMMIT;`
COMMIT;`
);
);
const
searchRes
:
QuoteItemType
[]
=
res
?.[
1
]?.
rows
||
[];
const
searchRes
:
QuoteItemType
[]
=
res
?.[
2
]?.
rows
||
[];
// filter same search result
// filter same search result
const
idSet
=
new
Set
<
string
>
();
const
idSet
=
new
Set
<
string
>
();
...
...
client/src/service/models/system.ts
View file @
7957f96d
...
@@ -21,6 +21,10 @@ const SystemSchema = new Schema({
...
@@ -21,6 +21,10 @@ const SystemSchema = new Schema({
type
:
Number
,
type
:
Number
,
default
:
10
default
:
10
},
},
pgIvfflatProbe
:
{
type
:
Number
,
default
:
10
},
sensitiveCheck
:
{
sensitiveCheck
:
{
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
...
...
client/src/service/mongo.ts
View file @
7957f96d
...
@@ -20,6 +20,7 @@ export async function connectToDatabase(): Promise<void> {
...
@@ -20,6 +20,7 @@ export async function connectToDatabase(): Promise<void> {
gpt4Key
:
process
.
env
.
GPT4KEY
||
''
,
gpt4Key
:
process
.
env
.
GPT4KEY
||
''
,
vectorMaxProcess
:
10
,
vectorMaxProcess
:
10
,
qaMaxProcess
:
10
,
qaMaxProcess
:
10
,
pgIvfflatProbe
:
10
,
sensitiveCheck
:
false
sensitiveCheck
:
false
};
};
// proxy obj
// proxy obj
...
...
client/src/types/index.d.ts
View file @
7957f96d
...
@@ -28,6 +28,7 @@ declare global {
...
@@ -28,6 +28,7 @@ declare global {
gpt4Key
:
string
;
gpt4Key
:
string
;
vectorMaxProcess
:
number
;
vectorMaxProcess
:
number
;
qaMaxProcess
:
number
;
qaMaxProcess
:
number
;
pgIvfflatProbe
:
number
;
sensitiveCheck
:
boolean
;
sensitiveCheck
:
boolean
;
};
};
...
...
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