| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>CyberFuture-3</title> |
| </head> |
| <body> |
| <div id="chat"></div> |
| <input type="text" id="input" placeholder="Type your question..."> |
| <button onclick="sendMessage()">Send</button> |
| <button onclick="startVoice()">Voice</button> |
| |
| <script> |
| async function sendMessage() { |
| const input = document.getElementById('input').value; |
| const response = await fetch('http://localhost:8000/chat/', { |
| method: 'POST', |
| headers: { |
| 'Content-Type': 'application/x-www-form-urlencoded', |
| }, |
| body: `prompt=${encodeURIComponent(input)}&use_web=true` |
| }); |
| const data = await response.json(); |
| document.getElementById('chat').innerHTML += `<p>You: ${input}</p>`; |
| document.getElementById('chat').innerHTML += `<p>Bot: ${data.response}</p>`; |
| } |
| |
| async function startVoice() { |
| |
| alert("Voice recording would be implemented here"); |
| } |
| </script> |
| </body> |
| </html> |