Spaces:
Runtime error

chatbot-backendd / index.html
Master-Ali's picture
Update index.html
2f75023 verified
Raw History Blame Contribute Delete
627 Bytes
<!DOCTYPE html>
<html>
<head>
<title>Chatbot Test</title>
</head>
<body>
<h2>Chatbot</h2>
<input id="msg" placeholder="Type message..." />
<button onclick="send()">Send</button>
<pre id="reply"></pre>
<script>
async function send() {
const msg = document.getElementById("msg").value;
const res = await fetch("/chat", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ message: msg })
});
const data = await res.json();
document.getElementById("reply").innerText = data.reply;
}
</script>
</body>
</html>