mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 17:15:08 +08:00
Refactor: improve close for presentation (#12957)
### What problem does this PR solve? improve close for presentation ### Type of change - [x] Refactoring
This commit is contained in:
@ -163,7 +163,11 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca
|
|||||||
logging.warning(f"{error_msg} for {filename}.")
|
logging.warning(f"{error_msg} for {filename}.")
|
||||||
raise NotImplementedError(error_msg)
|
raise NotImplementedError(error_msg)
|
||||||
|
|
||||||
binary_data = binary if binary else open(filename, 'rb').read()
|
if binary:
|
||||||
|
binary_data = binary
|
||||||
|
else:
|
||||||
|
with open(filename, 'rb') as f:
|
||||||
|
binary_data = f.read()
|
||||||
doc_parsed = tika_parser.from_buffer(BytesIO(binary_data))
|
doc_parsed = tika_parser.from_buffer(BytesIO(binary_data))
|
||||||
|
|
||||||
if doc_parsed.get("content", None) is not None:
|
if doc_parsed.get("content", None) is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user