File size: 630 Bytes
fa842bd e284fc2 fa842bd e284fc2 fa842bd e284fc2 fa842bd e284fc2 fa842bd e284fc2 fa842bd | 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 30 | <!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>
|