From 8fcadff8d3120d1f3e844cd030d59a8c2b0b2dfd Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 8 Aug 2025 20:13:54 -0700 Subject: [PATCH] mtmd: Use the base64 attachment for the UI preview instead of the file --- modules/chat.py | 1 - modules/html_generator.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index 354ae46b..98800239 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -640,7 +640,6 @@ def add_message_attachment(history, row_idx, file_path, is_user=True): "type": "image", "image_data": data_url, "image_id": image_id, - "file_path": str(path) # For UI preview } elif file_extension == '.pdf': # Process PDF file diff --git a/modules/html_generator.py b/modules/html_generator.py index 63a0cdd0..cb14a722 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -407,11 +407,10 @@ def format_message_attachments(history, role, index): name = html.escape(attachment["name"]) if attachment.get("type") == "image": - # Show image preview - file_path = attachment.get("file_path", "") + image_data = attachment.get("image_data", "") attachments_html += ( f'
' - f'{name}' + f'{name}' f'
{name}
' f'
' )