Fix: Sometimes VisionFigureParser.figures may is tuple (#7477)

### What problem does this PR solve?
https://github.com/infiniflow/ragflow/issues/7466
I think due to some times we can not get position 

### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu 2025-05-06 17:38:22 +08:00 committed by GitHub
parent c98933499a
commit 953b3e1b3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,8 +51,13 @@ class VisionFigureParser:
self.positions.append(item[1])
else:
assert len(item) == 2 and isinstance(item, tuple) and isinstance(item[1], list), f"get {len(item)=}, {item=}"
self.figures.append(item[0])
self.descriptions.append(item[1])
if isinstance(item[0], tuple) and len(item[0]) == 2 and isinstance(item[0][0], Image.Image) and isinstance(item[0][1], list):
self.figures.append(item[0][0])
self.descriptions.append(item[0][1])
else:
self.figures.append(item[0])
self.descriptions.append(item[1])
def _assemble(self):
self.assembled = []