Skip to content

Commit f1f349f

Browse files
committed
chore: limit paragraph list to first 5 segments in get_details method
1 parent a0d5b17 commit f1f349f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

apps/application/flow/step_node/document_split_node/impl/base_document_split_node.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,30 @@ def _generate_problem_list(
161161
return list(set(problem_list))
162162

163163
def get_details(self, index: int, **kwargs):
164+
paragraph_list = self.context.get('paragraph_list', [])
165+
# 每个文档保留前5个分段
166+
limited_paragraph_list = []
167+
for doc in paragraph_list:
168+
if doc.get('paragraphs'):
169+
doc_copy = doc.copy()
170+
doc_copy['paragraphs'] = doc['paragraphs'][:5]
171+
limited_paragraph_list.append(doc_copy)
172+
else:
173+
limited_paragraph_list.append(doc)
174+
paragraph_list = limited_paragraph_list
175+
164176
return {
165177
'name': self.node.properties.get('stepName'),
166178
"index": index,
167179
'run_time': self.context.get('run_time'),
168180
'type': self.node.type,
169181
'status': self.status,
170182
'err_message': self.err_message,
171-
'paragraph_list': self.context.get('paragraph_list', []),
183+
'paragraph_list': paragraph_list,
172184
'limit': self.context.get('limit'),
173185
'chunk_size': self.context.get('chunk_size'),
174186
'with_filter': self.context.get('with_filter'),
175187
'patterns': self.context.get('patterns'),
176188
'split_strategy': self.context.get('split_strategy'),
177-
'document_list': self.context.get('document_list', []),
189+
# 'document_list': self.context.get('document_list', []),
178190
}

0 commit comments

Comments
 (0)