Merge pull request #14774 from rragundez/images-from-db

fix: Store and load code interpreter generated images from a central location (DB and/or cloud storage)
This commit is contained in:
Tim Jaeryang Baek
2025-06-08 19:09:28 +04:00
committed by GitHub
2 changed files with 31 additions and 43 deletions

View File

@@ -420,7 +420,7 @@ def load_b64_image_data(b64_str):
try:
if "," in b64_str:
header, encoded = b64_str.split(",", 1)
mime_type = header.split(";")[0]
mime_type = header.split(";")[0].lstrip("data:")
img_data = base64.b64decode(encoded)
else:
mime_type = "image/png"
@@ -428,7 +428,7 @@ def load_b64_image_data(b64_str):
return img_data, mime_type
except Exception as e:
log.exception(f"Error loading image data: {e}")
return None
return None, None
def load_url_image_data(url, headers=None):