File size: 1,103 Bytes
11de855
 
7e92e60
 
 
 
 
 
 
 
 
 
 
 
 
1ceb38a
 
b53a8cc
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}