Fix vision OCR response parsing for dict-returning ollama client versions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-17 11:59:11 -04:00
parent 5b924e60de
commit b76d01b64f

View File

@@ -117,7 +117,10 @@ def _ocr_image_vision(data: bytes, filename: str, ollama_url: str, model: str) -
'images': [data],
}],
)
text = (response.message.content or '').strip()
if isinstance(response, dict):
text = (response.get('message', {}).get('content') or '').strip()
else:
text = (response.message.content or '').strip()
logger.debug('Vision OCR %s (%s): %d chars', filename, model, len(text))
return text
except ImportError: