Skip to content

Commit

Permalink
fix: message input field not clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
Satya Prakash Sasini authored and Satya Prakash Sasini committed Nov 8, 2024
1 parent 138761a commit 017d5cb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions chatbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ async function sendMessage() {
let input = document.getElementById("chatbot-input").value;
if (input) {
displayUserMessage(input);

document.getElementById("chatbot-input").value = ""; // Clearing the mesage iput field justn after user message is displayed.

// Wait for the chatbot response
let output = await chatbot(input); // Ensure this line is awaited

setTimeout(function () {
displayBotMessage(output);
}, 1000);

document.getElementById("chatbot-input").value = "";
}
}

Expand Down

0 comments on commit 017d5cb

Please sign in to comment.