enh/pref: convert markdown base64 images to urls

Co-Authored-By: Shirasawa <kaguyashirasawa@gmail.com>
This commit is contained in:
Timothy Jaeryang Baek
2025-11-20 04:00:02 -05:00
parent 17ac79920f
commit 4c28f19bdd
3 changed files with 30 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ from open_webui.routers.memories import query_memory, QueryMemoryForm
from open_webui.utils.webhook import post_webhook
from open_webui.utils.files import (
get_audio_url_from_base64,
convert_markdown_base64_images,
get_file_url_from_base64,
get_image_url_from_base64,
)
@@ -112,6 +112,7 @@ from open_webui.config import (
from open_webui.env import (
SRC_LOG_LEVELS,
GLOBAL_LOG_LEVEL,
ENABLE_CHAT_RESPONSE_BASE64_IMAGE_URL_CONVERSION,
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE,
CHAT_RESPONSE_MAX_TOOL_CALL_RETRIES,
BYPASS_MODEL_ACCESS_CONTROL,
@@ -2680,6 +2681,11 @@ async def process_chat_response(
}
)
if ENABLE_CHAT_RESPONSE_BASE64_IMAGE_URL_CONVERSION:
value = convert_markdown_base64_images(
request, value, metadata, user
)
content = f"{content}{value}"
if not content_blocks:
content_blocks.append(