This commit is contained in:
Josh Hawkins 2026-05-06 09:26:31 -05:00
parent d5effc52c0
commit d014a3412e

View File

@ -1,6 +1,7 @@
"""Ollama Provider for Frigate AI.""" """Ollama Provider for Frigate AI."""
import base64 import base64
import binascii
import json import json
import logging import logging
from typing import Any, AsyncGenerator, Optional from typing import Any, AsyncGenerator, Optional
@ -46,7 +47,7 @@ def _normalize_multimodal_content(
try: try:
encoded = url.split(",", 1)[1] encoded = url.split(",", 1)[1]
images.append(base64.b64decode(encoded, validate=True)) images.append(base64.b64decode(encoded, validate=True))
except (ValueError, IndexError, base64.binascii.Error) as e: except (ValueError, IndexError, binascii.Error) as e:
logger.debug("Failed to decode multimodal image url: %s", e) logger.debug("Failed to decode multimodal image url: %s", e)
return ("\n".join(text_parts) if text_parts else None), (images or None) return ("\n".join(text_parts) if text_parts else None), (images or None)