Skip to content

Commit 7816f8f

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
fix: image url to base64 conversion
1 parent a4226c1 commit 7816f8f

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

backend/open_webui/utils/middleware.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,13 +2057,16 @@ async def convert_url_images_to_base64(form_data):
20572057
continue
20582058

20592059
try:
2060-
base64_data = await asyncio.to_thread(get_image_base64_from_url, image_url)
2061-
new_content.append(
2062-
{
2063-
'type': 'image_url',
2064-
'image_url': {'url': base64_data},
2065-
}
2066-
)
2060+
base64_data = await get_image_base64_from_url(image_url)
2061+
if base64_data:
2062+
new_content.append(
2063+
{
2064+
'type': 'image_url',
2065+
'image_url': {'url': base64_data},
2066+
}
2067+
)
2068+
else:
2069+
new_content.append(item)
20672070
except Exception as e:
20682071
log.debug(f'Error converting image URL to base64: {e}')
20692072
new_content.append(item)

0 commit comments

Comments
 (0)