Spaces:
Sleeping
Sleeping
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<html> | |
<head> | |
<title>Wildlife Chatbot</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css')}}"/> | |
</head> | |
<body> | |
<div class="container-fluid h-100"> | |
<div class="row justify-content-center h-100"> | |
<div class="col-md-8 col-xl-6 chat"> | |
<div class="card"> | |
<div class="card-header msg_head"> | |
<div class="d-flex bd-highlight"> | |
<div class="img_cont"> | |
<!-- <img src="https://i.ibb.co/fSNP7Rz/icons8-chatgpt-512.png" class="rounded-circle user_img"> --> | |
<img src="https://th.bing.com/th/id/R.fe17139cebfdc76e1dadd7b8c5e699e0?rik=rIjnB52AqLwn8Q&pid=ImgRaw&r=0" class="rounded-circle user_img"> | |
<span class="online_icon"></span> | |
</div> | |
<div class="user_info"> | |
<span>Your travel chatbot</span> | |
<p>What do you want to know about Wildlife!</p> | |
</div> | |
</div> | |
</div> | |
<div id="messageFormeight" class="card-body msg_card_body"> | |
</div> | |
<div class="card-footer"> | |
<form id="messageArea" class="input-group"> | |
<input type="text" id="text" name="msg" placeholder="Type your message..." autocomplete="off" class="form-control type_msg" required/> | |
<div class="input-group-append"> | |
<button type="submit" id="send" class="input-group-text send_btn"><i class="fas fa-location-arrow"></i></button> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
$(document).ready(function() { | |
$("#messageArea").on("submit", function(event) { | |
const date = new Date(); | |
const hour = date.getHours(); | |
const minute = date.getMinutes(); | |
const str_time = hour+":"+minute; | |
var rawText = $("#text").val(); | |
var userHtml = '<div class="d-flex justify-content-end mb-4"><div class="msg_cotainer_send">' + rawText + '<span class="msg_time_send">'+ str_time + '</span></div><div class="img_cont_msg"><img src="https://th.bing.com/th/id/OIP.lUkqrMIP2BEr-zswwSmPngHaHa?pid=ImgDet&w=184&h=184&c=7&dpr=1.3" class="rounded-circle user_img_msg"></div></div>'; | |
$("#text").val(""); | |
$("#messageFormeight").append(userHtml); | |
$.ajax({ | |
data: { | |
msg: rawText, | |
}, | |
type: "POST", | |
url: "/get", | |
}).done(function(data) { | |
var botHtml = '<div class="d-flex justify-content-start mb-4"><div class="img_cont_msg"><img src="https://th.bing.com/th/id/R.fe17139cebfdc76e1dadd7b8c5e699e0?rik=rIjnB52AqLwn8Q&pid=ImgRaw&r=0" class="rounded-circle user_img_msg"></div><div class="msg_cotainer">' + data + '<span class="msg_time">' + str_time + '</span></div></div>'; | |
$("#messageFormeight").append($.parseHTML(botHtml)); | |
}); | |
event.preventDefault(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |