yuna-ai / templates /index.html
yukiarimo's picture
Create templates/index.html
6fc09f0 verified
raw
history blame
No virus
829 Bytes
<!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>