浏览代码

Check tika.parser return result (#3564)

### What problem does this PR solve?

Check tika.parser return result. Close #3229

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
tags/v0.14.0
Zhichang Yu 11 个月前
父节点
当前提交
482c1b59c8
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8
    3
      rag/app/naive.py

+ 8
- 3
rag/app/naive.py 查看文件

callback(0.1, "Start to parse.") callback(0.1, "Start to parse.")
binary = BytesIO(binary) binary = BytesIO(binary)
doc_parsed = parser.from_buffer(binary) doc_parsed = parser.from_buffer(binary)
sections = doc_parsed['content'].split('\n')
sections = [(_, "") for _ in sections if _]
callback(0.8, "Finish parsing.")
if doc_parsed.get('content', None) is not None:
sections = doc_parsed['content'].split('\n')
sections = [(_, "") for _ in sections if _]
callback(0.8, "Finish parsing.")
else:
callback(0.8, f"tika.parser got empty content from {filename}.")
logging.warning(f"tika.parser got empty content from {filename}.")
return []


else: else:
raise NotImplementedError( raise NotImplementedError(

正在加载...
取消
保存