Spaces:
Running
Running
Upload index.html
Browse files- index.html +60 -18
index.html
CHANGED
|
@@ -1,19 +1,61 @@
|
|
| 1 |
-
<!
|
| 2 |
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css')}}" />
|
| 6 |
+
<!-- <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css.css')}}" /> -->
|
| 7 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
| 8 |
+
</head>
|
| 9 |
+
|
| 10 |
+
<body>
|
| 11 |
+
<div class="row">
|
| 12 |
+
<div class="col-md-10 mr-auto ml-auto">
|
| 13 |
+
<h1>Ramakrushna Mohapatra-ChatBot</h1>
|
| 14 |
+
<form>
|
| 15 |
+
<div id="chatbox">
|
| 16 |
+
<div class="col-md-8 ml-auto mr-auto text-center">
|
| 17 |
+
<p class="botText"><span>Hi! I'm Your bot.</span></p>
|
| 18 |
+
</div>
|
| 19 |
+
</div>
|
| 20 |
+
<div id="userInput" class="row">
|
| 21 |
+
<div class="col-md-10">
|
| 22 |
+
<input id="text" type="text" name="msg" placeholder="Message" class="form-control">
|
| 23 |
+
<button type="submit" id="send" class="btn btn-warning">Send</button>
|
| 24 |
+
</div>
|
| 25 |
+
</div>
|
| 26 |
+
</form>
|
| 27 |
+
</div>
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
<script>
|
| 31 |
+
$(document).ready(function() {
|
| 32 |
+
$("form").on("submit", function(event) {
|
| 33 |
+
var rawText = $("#text").val();
|
| 34 |
+
var userHtml = '<p class="userText"><span>' + rawText + "</span></p>";
|
| 35 |
+
$("#text").val("");
|
| 36 |
+
$("#chatbox").append(userHtml);
|
| 37 |
+
document.getElementById("userInput").scrollIntoView({
|
| 38 |
+
block: "start",
|
| 39 |
+
behavior: "smooth",
|
| 40 |
+
});
|
| 41 |
+
$.ajax({
|
| 42 |
+
data: {
|
| 43 |
+
msg: rawText,
|
| 44 |
+
},
|
| 45 |
+
type: "POST",
|
| 46 |
+
url: "/get",
|
| 47 |
+
}).done(function(data) {
|
| 48 |
+
var botHtml = '<p class="botText"><span>' + data + "</span></p>";
|
| 49 |
+
$("#chatbox").append($.parseHTML(botHtml));
|
| 50 |
+
document.getElementById("userInput").scrollIntoView({
|
| 51 |
+
block: "start",
|
| 52 |
+
behavior: "smooth",
|
| 53 |
+
});
|
| 54 |
+
});
|
| 55 |
+
event.preventDefault();
|
| 56 |
+
});
|
| 57 |
+
});
|
| 58 |
+
</script>
|
| 59 |
+
</body>
|
| 60 |
+
|
| 61 |
+
</html>
|