Spaces:
Running
Running
Update static/application.js
Browse files- static/application.js +15 -2
static/application.js
CHANGED
@@ -237,7 +237,7 @@ document.head.appendChild(style);
|
|
237 |
|
238 |
});
|
239 |
*/
|
240 |
-
document.addEventListener("DOMContentLoaded", () => {
|
241 |
const convo = document.querySelector(".convo");
|
242 |
const input = document.querySelector(".qt input");
|
243 |
const sendBtn = document.querySelector(".sendingQA");
|
@@ -300,7 +300,20 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
300 |
|
301 |
filePreviewBubble = document.createElement("div");
|
302 |
filePreviewBubble.className = "file-preview-bubble bubble right";
|
303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
convo.appendChild(filePreviewBubble);
|
305 |
convo.scrollTop = convo.scrollHeight;
|
306 |
}
|
|
|
237 |
|
238 |
});
|
239 |
*/
|
240 |
+
document.addEventListener("DOMContentLoaded", () => {
|
241 |
const convo = document.querySelector(".convo");
|
242 |
const input = document.querySelector(".qt input");
|
243 |
const sendBtn = document.querySelector(".sendingQA");
|
|
|
300 |
|
301 |
filePreviewBubble = document.createElement("div");
|
302 |
filePreviewBubble.className = "file-preview-bubble bubble right";
|
303 |
+
|
304 |
+
if (type === "document") {
|
305 |
+
filePreviewBubble.textContent = `๐ Selected: ${file.name}`;
|
306 |
+
} else if (type === "image") {
|
307 |
+
const img = document.createElement("img");
|
308 |
+
img.src = URL.createObjectURL(file);
|
309 |
+
img.alt = "Selected Image";
|
310 |
+
img.style.maxWidth = "200px"; // Adjust the size of the image as needed
|
311 |
+
img.style.maxHeight = "200px"; // Adjust the size of the image as needed
|
312 |
+
img.style.borderRadius = "8px"; // Optional, for rounded corners
|
313 |
+
filePreviewBubble.appendChild(img);
|
314 |
+
filePreviewBubble.appendChild(document.createTextNode(` Selected: ${file.name}`));
|
315 |
+
}
|
316 |
+
|
317 |
convo.appendChild(filePreviewBubble);
|
318 |
convo.scrollTop = convo.scrollHeight;
|
319 |
}
|