Update index.html
Browse files123456456778910111213111415131415161716171819202122231920242526272324252829<!DOCTYPE html><html><head> <title>Chatbot Test</title></head><body>
<input id="msg" placeholder="Ask something"><button onclick="send()">Send</button><p id="reply"></p> <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 msg = document.getElementById("msg").value;
const res = await fetch("/chat", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({message: msg}) }); 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; const data = await res.json(); document.getElementById("reply").innerText = data.reply;}</script>
</script>
</body></html>index.html+17-15