-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
61 lines (57 loc) · 1.87 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>Sam</title>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: white;
}
#webchat {
width: inherit;
height: inherit;
margin: 0;
padding: 0;
background-color: white;
}
</style>
</head>
<body>
<div id="webchat"></div>
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.12/lib/index.min.js"></script>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const userid = urlParams.get('userid');
WebChat.default.init({
selector: "#webchat",
initPayload: "/start_session1", // This means that this frontend is for starting session 1. Set to "/start_session2" to start session 2, etc.
customData: {"language":"en", "userid": userid}, // arbitrary custom data. Stay minimal as this will be added to the socket
socketUrl: "http://localhost:5005",
socketPath: "/socket.io/",
fullScreenMode: true,
embedded: true,
title: "Sam",
subtitle: "",
params: {"storage": "session"} // can be set to "local" or "session". details in storage section.
})
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var hideSender = function() {
if( $('.rw-replies').length || $('#wave').length || $('.rw-message').length == 0){
$("textarea").prop('disabled', true);
$("textarea").prop('placeholder', "Use one of the buttons to answer.");
}
else {
$("textarea").prop('disabled', false);
$("textarea").prop('placeholder', "Type a message...");
}
}
setInterval(hideSender, 250);
</script>
</body>
</html>