Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,30 @@ def _generate_problem_list(
return list(set(problem_list))

def get_details(self, index: int, **kwargs):
paragraph_list = self.context.get('paragraph_list', [])
# 每个文档保留前5个分段
limited_paragraph_list = []
for doc in paragraph_list:
if doc.get('paragraphs'):
doc_copy = doc.copy()
doc_copy['paragraphs'] = doc['paragraphs'][:5]
limited_paragraph_list.append(doc_copy)
else:
limited_paragraph_list.append(doc)
paragraph_list = limited_paragraph_list

return {
'name': self.node.properties.get('stepName'),
"index": index,
'run_time': self.context.get('run_time'),
'type': self.node.type,
'status': self.status,
'err_message': self.err_message,
'paragraph_list': self.context.get('paragraph_list', []),
'paragraph_list': paragraph_list,
'limit': self.context.get('limit'),
'chunk_size': self.context.get('chunk_size'),
'with_filter': self.context.get('with_filter'),
'patterns': self.context.get('patterns'),
'split_strategy': self.context.get('split_strategy'),
'document_list': self.context.get('document_list', []),
# 'document_list': self.context.get('document_list', []),
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one minor issue with the provided code that will cause an error when rendering documents that do not contain paragraphs:

-           return self.context.get('document_list', []),
+           // 'document_list': self.context.get('document_list', []),

The // comment should be replaced with a single ' ' or removed entirely since it's causing syntax errors in Python.

Additionally, to avoid recalculating the paragraph limit each time the function is called, consider moving this logic into initialization methods (e.g., constructor) so it only runs once per instance of _GenerateProblemList.

Loading