ruchi commited on
Commit
34b3c02
·
1 Parent(s): fa02667

Add listerner

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. index.js +5 -0
index.html CHANGED
@@ -14,7 +14,7 @@
14
  <div class="chat-container">
15
  <div class="chat-box" id="chat-box"></div>
16
  <input type="text" id="user-input" placeholder="Type your message...">
17
- <button id="send-btn" onclick="sendMessage()">Send</button>
18
  </div>
19
 
20
  </body>
 
14
  <div class="chat-container">
15
  <div class="chat-box" id="chat-box"></div>
16
  <input type="text" id="user-input" placeholder="Type your message...">
17
+ <button id="send-btn">Send</button>
18
  </div>
19
 
20
  </body>
index.js CHANGED
@@ -2,6 +2,11 @@ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected].
2
 
3
  const answerer = await pipeline('question-answering', 'Xenova/distilbert-base-uncased-distilled-squad');
4
  var chatBox = document.getElementById("chat-box");
 
 
 
 
 
5
 
6
 
7
  // Function to handle sending message
 
2
 
3
  const answerer = await pipeline('question-answering', 'Xenova/distilbert-base-uncased-distilled-squad');
4
  var chatBox = document.getElementById("chat-box");
5
+ const sendMessageButton = document.getElementById('send-btn');
6
+
7
+ sendMessageButton.addEventListener('click', function (e) {
8
+ sendMessage()
9
+ });
10
 
11
 
12
  // Function to handle sending message