mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-04 03:16:03 -05:00
enh/pref: convert markdown base64 images to urls
Co-Authored-By: Shirasawa <kaguyashirasawa@gmail.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user