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
a9525398
authored
Aug 29, 2025
by
Archer
Committed by
GitHub
Aug 29, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: rrf code (#5558)
parent
e4756c76
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
19 deletions
+29
-19
.gitignore
+0
-3
document/content/docs/toc.mdx
+1
-0
document/content/docs/upgrading/4-12/4123.mdx
+17
-0
document/content/docs/upgrading/4-12/meta.json
+1
-1
document/data/doc-last-modified.json
+2
-2
packages/global/core/dataset/search/utils.ts
+5
-4
packages/service/core/dataset/search/controller.ts
+3
-9
test/cases/function/packages/global/core/dataset/search/utils.test.ts
+0
-0
No files found.
.gitignore
View file @
a9525398
...
@@ -38,5 +38,3 @@ files/helm/fastgpt/charts/*.tgz
...
@@ -38,5 +38,3 @@ files/helm/fastgpt/charts/*.tgz
tmp/
tmp/
coverage
coverage
document/.source
document/.source
bun.lock
\ No newline at end of file
document/content/docs/toc.mdx
View file @
a9525398
...
@@ -101,6 +101,7 @@ description: FastGPT 文档目录
...
@@ -101,6 +101,7 @@ description: FastGPT 文档目录
- [/docs/upgrading/4-12/4120](/docs/upgrading/4-12/4120)
- [/docs/upgrading/4-12/4120](/docs/upgrading/4-12/4120)
- [/docs/upgrading/4-12/4121](/docs/upgrading/4-12/4121)
- [/docs/upgrading/4-12/4121](/docs/upgrading/4-12/4121)
- [/docs/upgrading/4-12/4122](/docs/upgrading/4-12/4122)
- [/docs/upgrading/4-12/4122](/docs/upgrading/4-12/4122)
- [/docs/upgrading/4-12/4123](/docs/upgrading/4-12/4123)
- [/docs/upgrading/4-8/40](/docs/upgrading/4-8/40)
- [/docs/upgrading/4-8/40](/docs/upgrading/4-8/40)
- [/docs/upgrading/4-8/41](/docs/upgrading/4-8/41)
- [/docs/upgrading/4-8/41](/docs/upgrading/4-8/41)
- [/docs/upgrading/4-8/42](/docs/upgrading/4-8/42)
- [/docs/upgrading/4-8/42](/docs/upgrading/4-8/42)
...
...
document/content/docs/upgrading/4-12/4123.mdx
0 → 100644
View file @
a9525398
---
title: 'V4.12.3(进行中)'
description: 'FastGPT V4.12.3 更新说明'
---
## 🚀 新增内容
## ⚙️ 优化
1. 纠正 RRF 权重合并算法,使用标准 RRF 权重公式。
## 🐛 修复
## 🔨 工具更新
document/content/docs/upgrading/4-12/meta.json
View file @
a9525398
{
{
"title"
:
"4.12.x"
,
"title"
:
"4.12.x"
,
"description"
:
""
,
"description"
:
""
,
"pages"
:
[
"4122"
,
"4121"
,
"4120"
]
"pages"
:
[
"412
3"
,
"412
2"
,
"4121"
,
"4120"
]
}
}
document/data/doc-last-modified.json
View file @
a9525398
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
"document/content/docs/introduction/guide/DialogBoxes/htmlRendering.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/DialogBoxes/htmlRendering.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/DialogBoxes/quoteList.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/DialogBoxes/quoteList.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/admin/sso.mdx"
:
"2025-07-24T13:00:27+08:00"
,
"document/content/docs/introduction/guide/admin/sso.mdx"
:
"2025-07-24T13:00:27+08:00"
,
"document/content/docs/introduction/guide/admin/teamMode.mdx"
:
"2025-0
7-24T13:00:2
7+08:00"
,
"document/content/docs/introduction/guide/admin/teamMode.mdx"
:
"2025-0
8-27T16:59:5
7+08:00"
,
"document/content/docs/introduction/guide/course/ai_settings.mdx"
:
"2025-07-24T13:00:27+08:00"
,
"document/content/docs/introduction/guide/course/ai_settings.mdx"
:
"2025-07-24T13:00:27+08:00"
,
"document/content/docs/introduction/guide/course/chat_input_guide.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/course/chat_input_guide.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/course/fileInput.mdx"
:
"2025-07-23T21:35:03+08:00"
,
"document/content/docs/introduction/guide/course/fileInput.mdx"
:
"2025-07-23T21:35:03+08:00"
,
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
"document/content/docs/upgrading/4-11/4111.mdx"
:
"2025-08-07T22:49:09+08:00"
,
"document/content/docs/upgrading/4-11/4111.mdx"
:
"2025-08-07T22:49:09+08:00"
,
"document/content/docs/upgrading/4-12/4120.mdx"
:
"2025-08-12T22:45:19+08:00"
,
"document/content/docs/upgrading/4-12/4120.mdx"
:
"2025-08-12T22:45:19+08:00"
,
"document/content/docs/upgrading/4-12/4121.mdx"
:
"2025-08-15T22:53:06+08:00"
,
"document/content/docs/upgrading/4-12/4121.mdx"
:
"2025-08-15T22:53:06+08:00"
,
"document/content/docs/upgrading/4-12/4122.mdx"
:
"2025-08-2
6T23:51:54
+08:00"
,
"document/content/docs/upgrading/4-12/4122.mdx"
:
"2025-08-2
7T00:31:33
+08:00"
,
"document/content/docs/upgrading/4-8/40.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/40.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/41.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/41.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/42.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/42.mdx"
:
"2025-08-02T19:38:37+08:00"
,
...
...
packages/global/core/dataset/search/utils.ts
View file @
a9525398
...
@@ -18,7 +18,7 @@ export const datasetSearchResultConcat = (
...
@@ -18,7 +18,7 @@ export const datasetSearchResultConcat = (
item
.
list
.
forEach
((
data
,
index
)
=>
{
item
.
list
.
forEach
((
data
,
index
)
=>
{
const
rank
=
index
+
1
;
const
rank
=
index
+
1
;
const
score
=
(
weight
*
1
)
/
(
60
+
rank
);
const
score
=
weight
*
(
1
/
(
60
+
rank
)
);
const
record
=
map
.
get
(
data
.
id
);
const
record
=
map
.
get
(
data
.
id
);
if
(
record
)
{
if
(
record
)
{
// 合并两个score,有相同type的score,取最大值
// 合并两个score,有相同type的score,取最大值
...
@@ -64,8 +64,9 @@ export const datasetSearchResultConcat = (
...
@@ -64,8 +64,9 @@ export const datasetSearchResultConcat = (
});
});
}
}
// @ts-ignore
return
{
delete
item
.
rrfScore
;
...
item
,
return
item
;
rrfScore
:
undefined
};
});
});
};
};
packages/service/core/dataset/search/controller.ts
View file @
a9525398
...
@@ -849,22 +849,16 @@ export async function searchDatasetData(
...
@@ -849,22 +849,16 @@ export async function searchDatasetData(
}
}
})();
})();
// embedding recall and fullText recall rrf concat
const
embWeight
=
embeddingWeight
;
// 向量索引的 weight 大小
const
fullTextWeight
=
1
-
embeddingWeight
;
// 全文索引的 weight 大小
const
rrfSearchResult
=
datasetSearchResultConcat
([
const
rrfSearchResult
=
datasetSearchResultConcat
([
{
weight
:
embWeight
,
list
:
embeddingRecallResults
},
{
weight
:
emb
edding
Weight
,
list
:
embeddingRecallResults
},
{
weight
:
fullText
Weight
,
list
:
fullTextRecallResults
}
{
weight
:
1
-
embedding
Weight
,
list
:
fullTextRecallResults
}
]);
]);
const
rrfConcatResults
=
(()
=>
{
const
rrfConcatResults
=
(()
=>
{
if
(
reRankResults
.
length
===
0
)
return
rrfSearchResult
;
if
(
reRankResults
.
length
===
0
)
return
rrfSearchResult
;
if
(
rerankWeight
===
1
)
return
reRankResults
;
if
(
rerankWeight
===
1
)
return
reRankResults
;
const
searchWeight
=
1
-
rerankWeight
;
// 搜索结果的 weight 大小
return
datasetSearchResultConcat
([
return
datasetSearchResultConcat
([
{
weight
:
search
Weight
,
list
:
rrfSearchResult
},
{
weight
:
1
-
rerank
Weight
,
list
:
rrfSearchResult
},
{
weight
:
rerankWeight
,
list
:
reRankResults
}
{
weight
:
rerankWeight
,
list
:
reRankResults
}
]);
]);
})();
})();
...
...
test/cases/function/packages/global/core/dataset/search/utils.test.ts
0 → 100644
View file @
a9525398
This diff is collapsed.
Click to expand it.
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