mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
mtmd: Use the base64 attachment for the UI preview instead of the file
This commit is contained in:
parent
6e9de75727
commit
8fcadff8d3
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'<div class="attachment-box image-attachment">'
|
||||
f'<img src="file/{file_path}" alt="{name}" class="image-preview" />'
|
||||
f'<img src="{image_data}" alt="{name}" class="image-preview" />'
|
||||
f'<div class="attachment-name">{name}</div>'
|
||||
f'</div>'
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue