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:
@@ -117,7 +117,10 @@ def _ocr_image_vision(data: bytes, filename: str, ollama_url: str, model: str) -
|
|||||||
'images': [data],
|
'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))
|
logger.debug('Vision OCR %s (%s): %d chars', filename, model, len(text))
|
||||||
return text
|
return text
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
Reference in New Issue
Block a user