ikraamkb commited on
Commit
fe55f56
Β·
verified Β·
1 Parent(s): f6a844e

Update static/application.js

Browse files
Files changed (1) hide show
  1. static/application.js +19 -3
static/application.js CHANGED
@@ -304,7 +304,7 @@ document.addEventListener("DOMContentLoaded", () => {
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();
@@ -318,9 +318,17 @@ document.addEventListener("DOMContentLoaded", () => {
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);
325
  filePreviewBubble.appendChild(text);
326
  convo.appendChild(filePreviewBubble);
@@ -329,9 +337,17 @@ document.addEventListener("DOMContentLoaded", () => {
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);
336
  convo.appendChild(filePreviewBubble);
337
  convo.scrollTop = convo.scrollHeight;
 
304
  filePreviewBubble.style.flexDirection = "column";
305
  filePreviewBubble.style.maxWidth = "50%";
306
 
307
+ const userQuestion = input.value.trim(); // Only include the question if it was entered
308
 
309
  if (file.type.startsWith('image/')) {
310
  const reader = new FileReader();
 
318
  img.style.marginBottom = "8px";
319
 
320
  const text = document.createElement("span");
321
+ text.textContent = `πŸ“Ž Selected image: ${file.name}`;
322
  text.style.fontSize = "13px";
323
 
324
+ // If there's a user question, add the ❓
325
+ if (userQuestion) {
326
+ const question = document.createElement("span");
327
+ question.textContent = `\n❓ ${userQuestion}`;
328
+ question.style.fontSize = "13px";
329
+ filePreviewBubble.appendChild(question);
330
+ }
331
+
332
  filePreviewBubble.appendChild(img);
333
  filePreviewBubble.appendChild(text);
334
  convo.appendChild(filePreviewBubble);
 
337
  reader.readAsDataURL(file);
338
  } else {
339
  const text = document.createElement("span");
340
+ text.textContent = `πŸ“Ž Selected file: ${file.name}`;
341
  text.style.fontSize = "13px";
342
 
343
+ // If there's a user question, add the ❓
344
+ if (userQuestion) {
345
+ const question = document.createElement("span");
346
+ question.textContent = `\n❓ ${userQuestion}`;
347
+ question.style.fontSize = "13px";
348
+ filePreviewBubble.appendChild(question);
349
+ }
350
+
351
  filePreviewBubble.appendChild(text);
352
  convo.appendChild(filePreviewBubble);
353
  convo.scrollTop = convo.scrollHeight;