mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 04:32:50 +00:00
perf: hnsw query (#4596)
Some checks failed
Deploy doc image to cf / deploy-production (push) Has been cancelled
Deploy doc image by kubeconfig / build-fastgpt-docs-images (push) Has been cancelled
Build FastGPT images in Personal warehouse / build-fastgpt-images (push) Has been cancelled
Deploy doc image by kubeconfig / update-docs-image (push) Has been cancelled
Some checks failed
Deploy doc image to cf / deploy-production (push) Has been cancelled
Deploy doc image by kubeconfig / build-fastgpt-docs-images (push) Has been cancelled
Build FastGPT images in Personal warehouse / build-fastgpt-images (push) Has been cancelled
Deploy doc image by kubeconfig / update-docs-image (push) Has been cancelled
* perf: hnsw query * check response embedding recall result
This commit is contained in:
parent
d9a4a5f3e7
commit
61aa91b3aa
|
|
@ -12,7 +12,8 @@ weight: 793
|
|||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. Doc2x 文档解析,增加报错信息捕获,增加超时时长
|
||||
1. Doc2x 文档解析,增加报错信息捕获,增加超时时长。
|
||||
2. 调整 PG vector 查询语句,强制使用向量索引。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ export class PgVectorCtrl {
|
|||
WITH relaxed_results AS MATERIALIZED (
|
||||
select id, collection_id, vector <#> '[${vector}]' AS score
|
||||
from ${DatasetVectorTableName}
|
||||
where team_id='${teamId}'
|
||||
AND dataset_id IN (${datasetIds.map((id) => `'${String(id)}'`).join(',')})
|
||||
where dataset_id IN (${datasetIds.map((id) => `'${String(id)}'`).join(',')})
|
||||
${filterCollectionIdSql}
|
||||
${forbidCollectionSql}
|
||||
order by score limit ${limit}
|
||||
|
|
@ -202,6 +201,12 @@ export class PgVectorCtrl {
|
|||
);
|
||||
const rows = results?.[3]?.rows as PgSearchRawType[];
|
||||
|
||||
if (!Array.isArray(rows)) {
|
||||
return {
|
||||
results: []
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
results: rows.map((item) => ({
|
||||
id: String(item.id),
|
||||
|
|
|
|||
Loading…
Reference in New Issue