Skip to content

Commit 16f4905

Browse files
committed
fix: 修复返回的分段结果排序不对,不是按照命中高低顺序排序[BUG] #746 (#770)
(cherry picked from commit d554e0a)
1 parent a5ca97a commit 16f4905

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

apps/application/flow/step_node/search_dataset_node/impl/base_search_dataset_node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def execute(self, dataset_id_list, dataset_setting, question,
4040
return NodeResult({'paragraph_list': [], 'is_hit_handling_method': []}, {})
4141
paragraph_list = self.list_paragraph(embedding_list, vector)
4242
result = [self.reset_paragraph(paragraph, embedding_list) for paragraph in paragraph_list]
43+
result = sorted(result, key=lambda p: p.get('similarity'), reverse=True)
4344
return NodeResult({'paragraph_list': result,
4445
'is_hit_handling_method_list': [row for row in result if row.get('is_hit_handling_method')],
4546
'data': '\n'.join([paragraph.get('content') for paragraph in paragraph_list]),

0 commit comments

Comments
 (0)