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
61aa91b3
authored
Apr 18, 2025
by
Archer
Committed by
GitHub
Apr 18, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: hnsw query (#4596)
* perf: hnsw query * check response embedding recall result
parent
d9a4a5f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
docSite/content/zh-cn/docs/development/upgrading/497.md
+2
-1
packages/service/common/vectorStore/pg/class.ts
+7
-2
No files found.
docSite/content/zh-cn/docs/development/upgrading/497.md
View file @
61aa91b3
...
@@ -12,7 +12,8 @@ weight: 793
...
@@ -12,7 +12,8 @@ weight: 793
## ⚙️ 优化
## ⚙️ 优化
1.
Doc2x 文档解析,增加报错信息捕获,增加超时时长
1.
Doc2x 文档解析,增加报错信息捕获,增加超时时长。
2.
调整 PG vector 查询语句,强制使用向量索引。
## 🐛 修复
## 🐛 修复
...
...
packages/service/common/vectorStore/pg/class.ts
View file @
61aa91b3
...
@@ -192,8 +192,7 @@ export class PgVectorCtrl {
...
@@ -192,8 +192,7 @@ export class PgVectorCtrl {
WITH
relaxed_results
AS
MATERIALIZED
(
WITH
relaxed_results
AS
MATERIALIZED
(
select
id
,
collection_id
,
vector
<
#
>
'[${vector}]'
AS
score
select
id
,
collection_id
,
vector
<
#
>
'[${vector}]'
AS
score
from
$
{
DatasetVectorTableName
}
from
$
{
DatasetVectorTableName
}
where
team_id
=
'${teamId}'
where
dataset_id
IN
(
$
{
datasetIds
.
map
((
id
)
=>
`'
${
String
(
id
)}
'`
).
join
(
','
)})
AND
dataset_id
IN
(
$
{
datasetIds
.
map
((
id
)
=>
`'
${
String
(
id
)}
'`
).
join
(
','
)})
$
{
filterCollectionIdSql
}
$
{
filterCollectionIdSql
}
$
{
forbidCollectionSql
}
$
{
forbidCollectionSql
}
order
by
score
limit
$
{
limit
}
order
by
score
limit
$
{
limit
}
...
@@ -202,6 +201,12 @@ export class PgVectorCtrl {
...
@@ -202,6 +201,12 @@ export class PgVectorCtrl {
);
);
const rows = results?.[3]?.rows as PgSearchRawType[];
const rows = results?.[3]?.rows as PgSearchRawType[];
if (!Array.isArray(rows)) {
return {
results: []
};
}
return {
return {
results: rows.map((item) => ({
results: rows.map((item) => ({
id: String(item.id),
id: String(item.id),
...
...
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