chatbot1 / static /script.js
Yaswanth56's picture
Update static/script.js
b53a8cc verified
function sendMessage() {
const input = document.getElementById('user-input').value;
if (input) {
const userMessage = document.createElement('div');
userMessage.classList.add('chat-message', 'user');
userMessage.innerHTML = `<p>${input}</p>`;
document.getElementById('chatbot').appendChild(userMessage);
document.getElementById('user-input').value = '';
// Placeholder for Gradio Bot response (Add API call later)
const botMessage = document.createElement('div');
botMessage.classList.add('chat-message', 'bot');
botMessage.innerHTML = `<p>Bot is processing: ${input}...</p>`;
document.getElementById('chatbot').appendChild(botMessage);
document.getElementById('chatbot').scrollTop = document.getElementById('chatbot').scrollHeight;
}
}
function createButton(content, className, onClickHandler) {
const button = document.createElement('button');
button.classList.add('selection-btn', className);
button.innerText = content;
button.onclick = onClickHandler;
return button;
}