Spaces:
Running
Running
Update static/application.js
Browse files- static/application.js +8 -6
static/application.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
document.addEventListener("DOMContentLoaded", () => {
|
2 |
const convo = document.querySelector(".convo");
|
3 |
const input = document.querySelector(".qt input");
|
4 |
const sendBtn = document.querySelector(".sendingQA");
|
@@ -236,7 +236,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
236 |
document.head.appendChild(style);
|
237 |
|
238 |
});
|
239 |
-
|
240 |
document.addEventListener("DOMContentLoaded", () => {
|
241 |
const convo = document.querySelector(".convo");
|
242 |
const input = document.querySelector(".qt input");
|
@@ -304,6 +304,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
304 |
filePreviewBubble.style.flexDirection = "column";
|
305 |
filePreviewBubble.style.maxWidth = "50%";
|
306 |
|
|
|
|
|
307 |
if (file.type.startsWith('image/')) {
|
308 |
const reader = new FileReader();
|
309 |
reader.onload = (e) => {
|
@@ -316,7 +318,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
316 |
img.style.marginBottom = "8px";
|
317 |
|
318 |
const text = document.createElement("span");
|
319 |
-
text.textContent = `π Selected image: ${file.name}`;
|
320 |
text.style.fontSize = "13px";
|
321 |
|
322 |
filePreviewBubble.appendChild(img);
|
@@ -327,7 +329,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
327 |
reader.readAsDataURL(file);
|
328 |
} else {
|
329 |
const text = document.createElement("span");
|
330 |
-
text.textContent = `π Selected
|
331 |
text.style.fontSize = "13px";
|
332 |
|
333 |
filePreviewBubble.appendChild(text);
|
@@ -480,5 +482,5 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
480 |
`;
|
481 |
document.head.appendChild(style);
|
482 |
|
483 |
-
});
|
484 |
-
|
|
|
1 |
+
/*document.addEventListener("DOMContentLoaded", () => {
|
2 |
const convo = document.querySelector(".convo");
|
3 |
const input = document.querySelector(".qt input");
|
4 |
const sendBtn = document.querySelector(".sendingQA");
|
|
|
236 |
document.head.appendChild(style);
|
237 |
|
238 |
});
|
239 |
+
*/
|
240 |
document.addEventListener("DOMContentLoaded", () => {
|
241 |
const convo = document.querySelector(".convo");
|
242 |
const input = document.querySelector(".qt input");
|
|
|
304 |
filePreviewBubble.style.flexDirection = "column";
|
305 |
filePreviewBubble.style.maxWidth = "50%";
|
306 |
|
307 |
+
const userQuestion = input.value.trim() || "What is it?"; // Default question if none is provided
|
308 |
+
|
309 |
if (file.type.startsWith('image/')) {
|
310 |
const reader = new FileReader();
|
311 |
reader.onload = (e) => {
|
|
|
318 |
img.style.marginBottom = "8px";
|
319 |
|
320 |
const text = document.createElement("span");
|
321 |
+
text.textContent = `π Selected image: ${file.name}\nβ ${userQuestion}`;
|
322 |
text.style.fontSize = "13px";
|
323 |
|
324 |
filePreviewBubble.appendChild(img);
|
|
|
329 |
reader.readAsDataURL(file);
|
330 |
} else {
|
331 |
const text = document.createElement("span");
|
332 |
+
text.textContent = `π Selected file: ${file.name}\nβ ${userQuestion}`;
|
333 |
text.style.fontSize = "13px";
|
334 |
|
335 |
filePreviewBubble.appendChild(text);
|
|
|
482 |
`;
|
483 |
document.head.appendChild(style);
|
484 |
|
485 |
+
});
|
486 |
+
|