Diff of /templates/index.html [000000] .. [bb4041]

Switch to unified view

a b/templates/index.html
1
<!DOCTYPE html>
2
<html>
3
  <head>
4
    <link rel="stylesheet" type="text/css" href="/static/style.css">
5
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
6
  </head>
7
  <body>
8
    <h1>Automated Healthcare Chatbot</h1>
9
    <div>
10
      <div id="chatbox">
11
        <p class="botText"><span>Please try typing full sentences as I am still learning!</span></p>
12
        <p class="botText"><span>I am a chatbot. You can begin conversation by typing in a message and pressing enter.</span></p>
13
        <p class="botText"><span>Hi There! What is your name?</span></p>
14
      </div>
15
      <div id="userInput">
16
        <input id="textInput" type="text" name="msg" placeholder="Message">
17
        <input id="buttonInput" type="submit" value="Send">
18
      </div>
19
      <script>
20
        function getBotResponse() {
21
          var rawText = $("#textInput").val();
22
          var userHtml = '<p class="userText"><span>' + rawText + '</span></p>';
23
          $("#textInput").val("");
24
          $("#chatbox").append(userHtml);
25
          document.getElementById('userInput').scrollIntoView({block: 'start', behavior: 'smooth'});
26
          $.get("/get", { msg: rawText }).done(function(data) {
27
            var botHtml = '<p class="botText"><span>' + data + '</span></p>';
28
            $("#chatbox").append(botHtml);
29
            document.getElementById('userInput').scrollIntoView({block: 'start', behavior: 'smooth'});
30
          });
31
        }
32
        $("#textInput").keypress(function(e) {
33
            if(e.which == 13) {
34
                getBotResponse();
35
            }
36
        });
37
        $("#buttonInput").click(function() {
38
          getBotResponse();
39
        })
40
      </script>
41
    </div>
42
  </body>
43
</html>