-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsample.html
More file actions
52 lines (48 loc) · 1.19 KB
/
sample.html
File metadata and controls
52 lines (48 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>chatbot.js - Sample</title>
<link rel="stylesheet" href="chatbot.min.css">
<style>
/* chatbot.js as an app covering the full website. */
html, body {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" href="katex.min.css">
</head>
<body>
<script type="text/javascript" src="chatbot.compat.min.js"></script>
<script type="text/javascript">
var uiConfig= {
title: 'chatbot.js',
footerHtml: 'A chatbot can make mistakes. Check important info.'
};
var containerElement= document.getElementsByTagName('body')[0];
if (!window.location.href.startsWith('file:')) {
chatbotUi(chatbot(), containerElement, uiConfig).typeEverywhere(true);
} else {
// Dummy connector when there is no API:
// A chatbot that responds with the question in uppercase (delay: 0.8s)
var config= {
connector: {
send: function(callback, msg) {
return new Promise((resolve) => {
setTimeout(() => {
callback(msg.toUpperCase(), true);
resolve();
}, 800);
});
}
}
};
chatbotUi(chatbot(config), containerElement, uiConfig).typeEverywhere(true);
}
</script>
</body>
</html>