feat: admin set pgIvP

This commit is contained in:
archer
2023-06-10 23:10:35 +08:00
parent fb1392565d
commit 7957f96d2c
6 changed files with 13 additions and 1 deletions

View File

@@ -98,6 +98,7 @@ export async function appKbSearch({
// search kb
const res: any = await PgClient.query(
`BEGIN;
SET LOCAL ivfflat.probes = ${global.systemEnv.pgIvfflatProbe || 10};
select id,q,a,source from modelData where kb_id IN (${model.chat.relatedKbs
.map((item) => `'${item}'`)
.join(',')}) AND vector <#> '[${promptVector[0]}]' < -${similarity} order by vector <#> '[${
@@ -106,7 +107,7 @@ export async function appKbSearch({
COMMIT;`
);
const searchRes: QuoteItemType[] = res?.[1]?.rows || [];
const searchRes: QuoteItemType[] = res?.[2]?.rows || [];
// filter same search result
const idSet = new Set<string>();