MCPcopy Create free account
hub / github.com/Tencent/WeKnora / parse_into_text

Method parse_into_text

docreader/parser/image_parser.py:19–28  ·  view source on GitHub ↗
(self, content: bytes)

Source from the content-addressed store, hash-verified

17 """
18
19 def parse_into_text(self, content: bytes) -> Document:
20 logger.info("Parsing image file=%s, size=%d bytes", self.file_name, len(content))
21
22 ext = os.path.splitext(self.file_name)[1].lower() or ".png"
23 ref_path = f"images/{self.file_name}"
24
25 text = f"![{self.file_name}]({ref_path})"
26 images = {ref_path: base64.b64encode(content).decode()}
27
28 return Document(content=text, images=images)

Callers

nothing calls this directly

Calls 1

DocumentClass · 0.90

Tested by

no test coverage detected