From a76ae2d756d17a4da1d9451e4992a481233584cc Mon Sep 17 00:00:00 2001 From: VoidIsVoid <343750470@qq.com> Date: Wed, 15 May 2024 15:24:40 +0800 Subject: [PATCH] chore: remove useless code in knowledge_retrieval_node (#4412) --- .../nodes/knowledge_retrieval/knowledge_retrieval_node.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py index be3cec9152..3190856db2 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py +++ b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py @@ -146,7 +146,6 @@ class KnowledgeRetrievalNode(BaseNode): if 'score' in item.metadata and item.metadata['score']: document_score_list[item.metadata['doc_id']] = item.metadata['score'] - document_context_list = [] index_node_ids = [document.metadata['doc_id'] for document in all_documents] segments = DocumentSegment.query.filter( DocumentSegment.dataset_id.in_(dataset_ids), @@ -160,11 +159,6 @@ class KnowledgeRetrievalNode(BaseNode): sorted_segments = sorted(segments, key=lambda segment: index_node_id_to_position.get(segment.index_node_id, float('inf'))) - for segment in sorted_segments: - if segment.answer: - document_context_list.append(f'question:{segment.content} answer:{segment.answer}') - else: - document_context_list.append(segment.content) for segment in sorted_segments: dataset = Dataset.query.filter_by(