sathaye3 commited on
Commit
601b758
·
verified ·
1 Parent(s): a50c30f

the document is not getting uploaded

Browse files
Files changed (1) hide show
  1. index.html +15 -11
index.html CHANGED
@@ -79,17 +79,21 @@
79
  const sendBtn = document.getElementById('send-btn');
80
  const fileUpload = document.getElementById('file-upload');
81
  const fileName = document.getElementById('file-name');
82
-
83
- fileUpload.addEventListener('change', function(e) {
84
- if (e.target.files.length > 0) {
85
- fileName.textContent = e.target.files[0].name;
86
- await processDocument(e.target.files[0]);
87
- addMessage('bot', 'Document uploaded! You can now ask questions about it.');
88
- }
89
- });
90
-
91
- sendBtn.addEventListener('click', sendMessage);
92
- userInput.addEventListener('keypress', function(e) {
 
 
 
 
93
  if (e.key === 'Enter') sendMessage();
94
  });
95
 
 
79
  const sendBtn = document.getElementById('send-btn');
80
  const fileUpload = document.getElementById('file-upload');
81
  const fileName = document.getElementById('file-name');
82
+ fileUpload.addEventListener('change', async function(e) {
83
+ if (e.target.files.length > 0) {
84
+ fileName.textContent = e.target.files[0].name;
85
+ await processDocument(e.target.files[0]);
86
+ addMessage('bot', 'Document uploaded! You can now ask questions about it.');
87
+ }
88
+ });
89
+ sendBtn.addEventListener('click', function() {
90
+ if (!documentContent) {
91
+ addMessage('bot', 'Please upload a document first.');
92
+ return;
93
+ }
94
+ sendMessage();
95
+ });
96
+ userInput.addEventListener('keypress', function(e) {
97
  if (e.key === 'Enter') sendMessage();
98
  });
99