File size: 829 Bytes
6fc09f0 |
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 27 28 29 |
<!DOCTYPE html>
<html>
<head>
<title>AI App Demo</title>
</head>
<body>
<h1>AI App Demo</h1>
<input type="text" id="userInput" placeholder="Enter your message">
<button onclick="sendMessage()">Send</button>
<div id="response"></div>
<script>
function sendMessage() {
const userInput = document.getElementById('userInput').value;
fetch('/api/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ message: userInput })
})
.then(response => response.json())
.then(data => {
document.getElementById('response').innerHTML = data.response;
});
}
</script>
</body>
</html> |