Skip to content

Commit 3dc7559

Browse files
committed
fix: 修复文档提取报错没有显示的问题
1 parent 33ed8aa commit 3dc7559

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@ def execute(self, document, **kwargs):
2929
# 回到文件头
3030
buffer.seek(0)
3131
file_content = split_handle.get_content(buffer)
32-
content.append( '## ' + doc['name'] + '\n' + file_content)
32+
content.append('## ' + doc['name'] + '\n' + file_content)
3333
break
3434

3535
return NodeResult({'content': splitter.join(content)}, {})
3636

3737
def get_details(self, index: int, **kwargs):
38+
# 不保存content全部内容,因为content内容可能会很大
39+
content = (self.context.get('content')[:500] + '...') if len(self.context.get('content')) > 0 else ''
3840
return {
3941
'name': self.node.properties.get('stepName'),
4042
"index": index,
4143
'run_time': self.context.get('run_time'),
4244
'type': self.node.type,
43-
'content': self.context.get('content')[:500] + '...', # 不保存content全部内容,因为content内容可能会很大
45+
'content': content,
4446
'status': self.status,
4547
'err_message': self.err_message,
4648
'document_list': self.context.get('document_list')

apps/common/handle/impl/doc_split_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@ def get_content(self, file):
198198
return self.to_md(doc, image_list, get_image_id_func())
199199
except BaseException as e:
200200
traceback.print_exception(e)
201-
return ''
201+
return f'{e}'

apps/common/handle/impl/html_split_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ def get_content(self, file):
7070
return html2text(content)
7171
except BaseException as e:
7272
traceback.print_exception(e)
73-
return ''
73+
return f'{e}'

apps/common/handle/impl/pdf_split_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,4 @@ def get_content(self, file):
321321
return self.handle_pdf_content(file, pdf_document)
322322
except BaseException as e:
323323
traceback.print_exception(e)
324-
return ''
324+
return f'{e}'

apps/common/handle/impl/text_split_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ def get_content(self, file):
5757
return buffer.decode(detect(buffer)['encoding'])
5858
except BaseException as e:
5959
traceback.print_exception(e)
60-
return ''
60+
return f'{e}'

0 commit comments

Comments
 (0)