-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFAQ.html
More file actions
226 lines (207 loc) · 7.6 KB
/
FAQ.html
File metadata and controls
226 lines (207 loc) · 7.6 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html>
<head>
<title>SHEP AI</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="shortcut icon" href="assets/test1.ico" type="favicon/ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css">
</head>
<body class="backgroundC">
<div class="topnav">
<p class="title" align="center">Dexter Shepherd</p>
<a align="left" class="topnavlogo"><img src="assets/eyeT.png" width="50px" height="50px"></a>
<a class="topnavleft" href="index.html">Home</a>
<a class="topnavleft" href="index.html#about">About</a>
<a class="topnavleft" href="downloads.html">Downloads</a>
<a class="topnavleft" href="contact.html">Contact</a>
<br>
<!-- <a align="right" href="https://www.facebook.com/SHEP-AI-101118428133298/" class="fa fa-facebook"></a>
<a align="right" href="https://twitter.com/ai_shep" class="fa fa-twitter"></a>
<a align="right" href="https://www.instagram.com/shep.ai/" class="fa fa-instagram"></a>
<a align="right" href="https://www.youtube.com/channel/UCQr_MHaJ53feVK19lDKDxCQ?view_as=subscriber" class="fa fa-youtube"></a> -->
<a align="right" href="https://scholar.google.com/citations?hl=en&user=hJSy6CYAAAAJ" class="ai ai-google-scholar ai-2x"></a>
<a align="right" href="https://github.com/shepai" class="fa fa-github"></a>
<a align="right" href="https://www.linkedin.com/in/dexter-shepherd-1a4a991b8/" class="fa fa-linkedin"></a>
<a class="topnavright" class="search-container"><input id="searchbar" type="text" placeholder="Search.." name="search"></a>
<a href="#" class="topnavright"><i onclick="search()" class="icon fa fa-search"></i></a>
<script src="jquery.js">
</script>
<script src="search.js">
</script>
</div>
<!-- the main content -->
<br>
<div class="main">
<div align="center" class="iconPage">
<img class="imageCircle" src="assets/eyeCall.png">
</div>
<h1 class="headerText">Ask Us Questions</h1>
<hr class="break">
<h3 class="contentText">SHEP has auto responses to FAQs, if SHEP is unable to help you you will be redirected to the contact page where you can
ask question which will be added to the data.</h3>
<div id="myModal" class="modal">
<!-- Modal content -->
<div align="center" class="modal-content">
<span class="close">×</span>
<p>Did this answer your question?</p>
<img onClick="posFeedback()" style="cursor:pointer;" width="60" height="60" src="assets/application/happy.jpg"><img onClick="negFeedback()" style="cursor:pointer;" width="60" height="60" src="assets/application/sad.jpg" >
</div>
</div>
<div id="mainContent" class="messageActivate">
</div>
<br><br>
<div align="center" class="sendMessage">
<br>
<input type="text" id="messageFAQ" class="messageBox" name="fname"><button onClick="enterMessage()" class="FAQButton" value="send">send</button>
</div>
<a onClick="report()"><p style="cursor: pointer;"><u> Report False information </u></p></a>
</div>
</body>
<script type="text/javascript">
var con=new WebSocket("ws://80.5.202.205:50007") //ws://echo.websocket.org
var lastMessage="";
var lastAnswer="";
var subs="";
con.onopen=function(){con.send("hi"+"---"+"");};
con.onerror=function(error){console.log("error"+error);};
con.onmessage=function(e){
console.log("message:"+e.data);
var vals=e.data.split("---");
var output=vals[0];
subs=vals[1];
var string="";
output=output.replace(/([\[(])(.+?)([\])])/g, "");
var add2;
output=output.split("$"); //splitn to sentences
if(num>0){
var tempID=document.getElementById(num-1).innerHTML;
tempID=tempID.replace("?",".");
tempID=tempID.replace("!",".");
tempID=tempID.replace(/'/g,'\'');
tempID=tempID.split(".");
}
for(i=0;i<output.length;i++){
if(output[i]!=""){
add2='<br id="'+num+"bR"+'"><div id="'+num+'" class="shepMessage">'+output[i]+'</div><div id="'+num+'" class="msgBrk"></div>';
if(output[i].includes("This is something similar I found which may answer your question")){
var temp=output[i].replace("This is something similar I found which may answer your question ","");
temp=temp.replace(/'/g,"");
add2='<br id="'+num+"bR"+'"><div id="'+num+'" class="shepMessage">'+output[i]+'<a onClick="feedback('+"'"+tempID[i]+"'"+','+"'"+temp+"'"+')"><p style="cursor: pointer;"><u> Did this answer your question? </u></p></a>'+'</div><div id="'+num+'" class="msgBrk"></div>'
}
num=num+1;
document.getElementById("mainContent").innerHTML+=add2;
}}
};
var startNum=0;
var num=0;
function enterMessage()
{
console.log("test");
var text=document.getElementById("messageFAQ").value;
var add='<br id="'+num+"bR"+'"><div id="'+num+'" class="userMessage">'+text+'</div><div id="'+num+'" class="msgBrk"></div>';
num=num+1;
text=text.toLowerCase();
//VALIDATE
text=text.replace("---","");
text=text.replace("FEEDBACKN","");
text=text.replace("FEEDBACKP","");
text=text.replace(":::","");
text=text.replace("[","(");
text=text.replace("]",")");
if(text.length<500){
con.send(text+"---"+subs);
lastMessage=text;
document.getElementById("mainContent").innerHTML+=add;
document.getElementById("messageFAQ").value="";
removeTop();
}else{
alert("Please decrease the size of your message");
}
}
function removeTop()
{
if(num+startNum > 10)
{
document.getElementById(startNum.toString()+"bR").remove();
document.getElementById((startNum+1).toString()+"bR").remove();
document.getElementById(startNum.toString()).remove();
document.getElementById((startNum+1).toString()).remove();
document.getElementById(startNum.toString()).remove();
document.getElementById((startNum+1).toString()).remove();
startNum+=2;
}
}
function report()
{
var text = prompt("Please enter the question you would like fixed:", "");
text=text.replace("---","");
text=text.replace("FEEDBACKN","");
text=text.replace("FEEDBACKP","");
text=text.replace(":::","");
text=text.toLowerCase();
if(text.length<500)
{
if(text!=null && text!="")
{
//submit report to the system
con.send("REPORT"+text);
}else{
alert("Invalid input");
}
}
}
function feedback(id,answer)
{
//open up feedback dialogue
modal.style.display = "block";
lastMessage=id;
lastAnswer=answer;
}
function posFeedback()
{
//return positive feedback to the system
modal.style.display = "none";
con.send("FEEDBACKP"+lastMessage+"---"+lastAnswer);
//add to system
}
function negFeedback()
{
//return negative feedback
console.log("negative");
con.send("FEEDBACKN"+lastMessage);
modal.style.display = "none";
}
function toPython(usrdata){
console.log("uploading"+usrdata);
$.ajax({
url: "http://80.5.202.205:50007",
type: "POST",
data: { information : "From SHEP client" , userdata : usrdata },
dataType: "json",
success: function(data) {
console.log("connected");
console.log(data);
}});
//$("#someButton").bind('click', toPython(something));
}
</script>
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</html>