fix: image url to base64 conversion (#23685)
This commit is contained in:
@@ -2054,13 +2054,16 @@ async def convert_url_images_to_base64(form_data):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
base64_data = await asyncio.to_thread(get_image_base64_from_url, image_url)
|
base64_data = await get_image_base64_from_url(image_url)
|
||||||
new_content.append(
|
if base64_data:
|
||||||
{
|
new_content.append(
|
||||||
'type': 'image_url',
|
{
|
||||||
'image_url': {'url': base64_data},
|
'type': 'image_url',
|
||||||
}
|
'image_url': {'url': base64_data},
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
new_content.append(item)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug(f'Error converting image URL to base64: {e}')
|
log.debug(f'Error converting image URL to base64: {e}')
|
||||||
new_content.append(item)
|
new_content.append(item)
|
||||||
|
|||||||
Reference in New Issue
Block a user