Agent Zero AI framework
improved UI for images and non images in chat
deci135291b523de
diff --git a/webui/index.css b/webui/index.cssindex f07dbb2f3..9d36a547d 100644--- a/webui/index.css+++ b/webui/index.css@@ -777,13 +777,13 @@ pre {flex-shrink: 0;}-/* Preview section */+/* Preview section with unified tile system */.preview-section {- display: flex;- flex-wrap: wrap;- gap: 8px;+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));+ gap: 12px;margin-bottom: 10px;- padding: var(--spacing-xs);+ padding: var(--spacing-sm);transition: all 0.3s ease;background-color: var(--color-input);border-radius: 8px;@@ -792,45 +792,115 @@ pre {.preview-item {position: relative;- flex-shrink: 0;+ width: 120px;+ height: 120px;+ background-color: var(--color-background);+ border: 2px solid var(--color-border);+ border-radius: 12px;+ display: flex;+ align-items: center;+ justify-content: center;+ overflow: hidden;+ cursor: pointer;+ transition: all 0.3s ease;animation: fadeIn 0.3s ease;+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);+}++.preview-item:hover {+ border-color: var(--color-primary);+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);+ transform: translateY(-2px);}.preview-item.image-preview img {- max-height: 100px;+ width: 100%;+ height: 100%;object-fit: cover;- border-radius: 8px;- border: 1px solid var(--color-border-light);+ border-radius: 10px;+}++.preview-item.file-preview {+ flex-direction: column;+ padding: 12px;+ text-align: center;+}++.preview-item.file-preview .file-icon {+ width: 48px;+ height: 48px;+ margin-bottom: 8px;+ opacity: 0.8;+}++.preview-item.file-preview .file-info {+ display: flex;+ flex-direction: column;+ gap: 4px;+ align-items: center;+}++.preview-item.file-preview .filename {+ font-size: 0.75rem;+ color: var(--color-text);+ word-break: break-word;+ line-height: 1.2;+ max-height: 2.4em;+ overflow: hidden;+ text-overflow: ellipsis;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+}++.preview-item.file-preview .extension {+ background: var(--color-primary);+ color: var(--color-text);+ padding: 2px 6px;+ border-radius: 4px;+ font-size: 0.7rem;+ text-transform: uppercase;+ white-space: nowrap;}.remove-attachment,.remove-image {position: absolute;- top: -6px;- right: -6px;+ top: 4px;+ right: 4px;background-color: var(--color-accent);color: white;border: none;border-radius: 50%;- width: 20px;- height: 20px;+ width: 24px;+ height: 24px;cursor: pointer;display: flex;align-items: center;justify-content: center;- transition: background-color 0.2s ease, transform 0.1s ease-in-out;- z-index: 1;+ transition: all 0.2s ease;+ z-index: 2;+ opacity: 0;+ transform: scale(0.8);+}++.preview-item:hover .remove-attachment,+.attachment-item:hover .remove-attachment,+.preview-item:hover .remove-image,+.attachment-item:hover .remove-image {+ opacity: 1;+ transform: scale(1);}.remove-attachment:hover,.remove-image:hover {background-color: var(--color-accent-dark);- transform: scale(1.1);+ transform: scale(1.1) !important;}.remove-attachment:active,.remove-image:active {- transform: scale(0.9);+ transform: scale(0.9) !important;}.image-error {@@ -1066,66 +1136,141 @@ pre {opacity: 0.5;}-/* Message attachments styles */+/* Message attachments with unified tile system */.attachments-container {- margin-top: 0.5em;- display: flex;- flex-direction: column;- gap: 0.5em;+ margin-top: 0.75em;+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));+ gap: 12px;+ padding: var(--spacing-sm);+ background-color: var(--color-input);+ border-radius: 8px;+ max-width: 600px; /* Limits to ~5 columns at 120px each */+ overflow: visible;}.attachment-item {+ position: relative;+ width: 120px;+ height: 120px;+ background-color: var(--color-background);+ border: 2px solid var(--color-border);+ border-radius: 12px;display: flex;align-items: center;- gap: 1em;- background: var(--color-background);- padding: 0.5em;- border-radius: 4px;- transition: background-color 0.2s ease;+ justify-content: center;+ overflow: hidden;+ cursor: pointer;+ transition: all 0.3s ease;+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);}.attachment-item:hover {- background: var(--color-secondary);+ border-color: var(--color-primary);+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);+ transform: translateY(-2px);+}++/* Image attachment styling */+.attachment-item.image-type {+ padding: 0;+}++.attachment-item.image-type .attachment-preview {+ width: 100%;+ height: 100%;+ object-fit: cover;+ border-radius: 10px;+}++.attachment-item.image-type .image-badge {+ position: absolute;+ bottom: 6px;+ left: 50%;+ transform: translateX(-50%);+ background: rgba(0, 0, 0, 0.7);+ color: white;+ padding: 2px 8px;+ border-radius: 12px;+ font-size: 0.65rem;+ text-transform: uppercase;+ backdrop-filter: blur(4px);+ -webkit-backdrop-filter: blur(4px);}+/* File attachment styling */.attachment-item.file-type {- background: var(--color-background);+ flex-direction: column;+ padding: 12px;+ text-align: center;}-.attachment-item:hover {- background: var(--color-secondary);+.attachment-item.file-type .file-icon {+ width: 48px;+ height: 48px;+ margin-bottom: 8px;+ opacity: 0.8;}-.attachment-preview {- max-width: 100px;- max-height: 100px;+.attachment-item.file-type .file-title {+ font-size: 0.75rem;+ color: var(--color-text);+ word-break: break-word;+ line-height: 1.2;+ max-height: 2.4em;+ overflow: hidden;+ text-overflow: ellipsis;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ text-align: center;+ margin-bottom: 4px;+}++.attachment-item.file-type .file-extension {+ background: var(--color-primary);+ color: var(--color-text);+ padding: 2px 6px;border-radius: 4px;- object-fit: contain;+ font-size: 0.7rem;+ text-transform: uppercase;+ white-space: nowrap;}-.attachment-image .attachment-preview {- margin-right: 8px;+.attachment-preview {+ width: 100%;+ height: 100%;+ object-fit: cover;+ border-radius: 10px;}-.attachment-info,-.file-info {- display: flex;- align-items: center;- gap: 8px;+.attachment-image .attachment-preview {+ margin-right: 0;}+.attachment-info,.file-info {display: flex;+ flex-direction: column;+ gap: 4px;align-items: center;- gap: 0.5em;+ width: 100%;}.attachment-name,.filename,.file-name {- font-size: 0.9em;+ font-size: 0.75rem;color: var(--color-text);word-break: break-word;+ line-height: 1.2;+ max-height: 2.4em;+ overflow: hidden;+ text-overflow: ellipsis;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ text-align: center;}.attachment-ext,@@ -1135,7 +1280,7 @@ pre {color: var(--color-text);padding: 2px 6px;border-radius: 4px;- font-size: 0.8em;+ font-size: 0.7rem;text-transform: uppercase;white-space: nowrap;}@@ -1169,17 +1314,24 @@ pre {}.image-wrapper {- width: 100px;- height: 100px;+ width: 100%;+ height: 100%;display: flex;align-items: center;justify-content: center;+ overflow: hidden;+ border-radius: 10px;}.file-preview {display: flex;+ flex-direction: column;align-items: center;- gap: 0.5em;+ gap: 8px;+ width: 100%;+ height: 100%;+ padding: 12px;+ text-align: center;}.extension {@@ -1187,7 +1339,7 @@ pre {color: var(--color-text);padding: 2px 6px;border-radius: 4px;- font-size: 0.8em;+ font-size: 0.7rem;text-transform: uppercase;}@@ -1731,6 +1883,70 @@ input:checked + .slider:before {.kvps-val {margin: 0 0 0.4rem 0;}++ /* Responsive tiles for mobile */+ .preview-section {+ grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));+ gap: 8px;+ padding: var(--spacing-xs);+ }++ .attachments-container {+ grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));+ gap: 8px;+ padding: var(--spacing-xs);+ max-width: 300px; /* Limits to ~3 columns at 90px each */+ }++ .preview-item,+ .attachment-item {+ width: 90px;+ height: 90px;+ border-radius: 8px;+ }++ .preview-item.file-preview,+ .attachment-item.file-type {+ padding: 8px;+ }++ .preview-item.file-preview .file-icon,+ .attachment-item.file-type .file-icon {+ width: 32px;+ height: 32px;+ margin-bottom: 4px;+ }++ .preview-item.file-preview .filename,+ .attachment-item.file-type .file-title,+ .attachment-name,+ .filename {+ font-size: 0.65rem;+ -webkit-line-clamp: 1;+ }++ .preview-item.file-preview .extension,+ .attachment-item.file-type .file-extension,+ .attachment-item.image-type .image-badge,+ .attachment-ext,+ .extension {+ font-size: 0.6rem;+ padding: 1px 4px;+ }++ .remove-attachment,+ .remove-image {+ width: 20px;+ height: 20px;+ top: 2px;+ right: 2px;+ }++ .attachment-item.image-type .image-badge {+ bottom: 4px;+ font-size: 0.55rem;+ padding: 1px 6px;+ }}@media (max-width: 640px) {diff --git a/webui/js/messages.js b/webui/js/messages.jsindex 6862d1960..6d8f0d6d8 100644--- a/webui/js/messages.js+++ b/webui/js/messages.js@@ -375,9 +375,8 @@ export function drawMessageUser(}if (displayInfo.isImage) {- // Render as image with enhanced device sync support- const imgWrapper = document.createElement("div");- imgWrapper.classList.add("image-wrapper");+ // Render as image tile with bottom badge+ attachmentDiv.classList.add("image-type");const img = document.createElement("img");img.src = displayInfo.previewUrl;@@ -386,44 +385,38 @@ export function drawMessageUser(img.style.cursor = "pointer";img.addEventListener('click', displayInfo.clickHandler);- const fileInfo = document.createElement("div");- fileInfo.classList.add("file-info");- fileInfo.innerHTML = `- <span class="filename">${displayInfo.filename}</span>- <span class="extension">${displayInfo.extension}</span>- `;+ const imageBadge = document.createElement("div");+ imageBadge.classList.add("image-badge");+ imageBadge.textContent = displayInfo.extension;- imgWrapper.appendChild(img);- attachmentDiv.appendChild(imgWrapper);- attachmentDiv.appendChild(fileInfo);+ attachmentDiv.appendChild(img);+ attachmentDiv.appendChild(imageBadge);} else {- // Render as file with icon support for device sync+ // Render as file tile with title and iconattachmentDiv.classList.add("file-type");- // Create file preview with potential server-side icon- const filePreview = document.createElement("div");- filePreview.classList.add("file-preview");-- // If we have a preview URL (server icon), show it+ // File iconif (displayInfo.previewUrl && displayInfo.previewUrl !== displayInfo.filename) {const iconImg = document.createElement("img");iconImg.src = displayInfo.previewUrl;iconImg.alt = `${displayInfo.extension} file`;iconImg.classList.add("file-icon");- iconImg.style.width = "24px";- iconImg.style.height = "24px";- iconImg.style.marginRight = "8px";- filePreview.appendChild(iconImg);+ attachmentDiv.appendChild(iconImg);}- const textInfo = document.createElement("div");- textInfo.innerHTML = `- <span class="filename">${displayInfo.filename}</span>- <span class="extension">${displayInfo.extension}</span>- `;- filePreview.appendChild(textInfo);+ // File title (filename without extension)+ const fileTitle = document.createElement("div");+ fileTitle.classList.add("file-title");+ const nameWithoutExt = displayInfo.filename.replace(/\.[^/.]+$/, "");+ fileTitle.textContent = nameWithoutExt;++ // File extension badge+ const fileExtension = document.createElement("div");+ fileExtension.classList.add("file-extension");+ fileExtension.textContent = displayInfo.extension;- attachmentDiv.appendChild(filePreview);+ attachmentDiv.appendChild(fileTitle);+ attachmentDiv.appendChild(fileExtension);}