Update ollama.py for image handling

Some clients (eg librechat) send images in datauri format, not plain base64.  Strip off the prerix when passing images to ollama.
This commit is contained in:
frob 2024-04-07 13:05:39 +02:00 • committed by GitHub
parent 3b6b497672
commit d5c1ae1cb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -157,7 +157,7 @@ def get_ollama_response(
if format is not None:
data["format"] = format
if images is not None:
data["images"] = images
data["images"] = [image.split(",")[-1] if image.startswith("data:") else image for image in images]
## LOGGING
logging_obj.pre_call(