Spaces:
Runtime error

File size: 627 Bytes
80a7ca6
2f75023
80a7ca6
2f75023
80a7ca6
 
2f75023
 
 
 
80a7ca6
 
2f75023
 
 
 
 
 
 
 
 
 
 
 
80a7ca6
 
2f75023
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
<!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>