-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
70 lines (66 loc) · 2.06 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
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cheshire Cat Chat</title>
<style>
body {
display: flex;
flex-direction: column;
padding: 0.5rem;
height: 100vh;
max-height: 100vh;
min-height: 100vh;
}
.chat-title {
font-size: 3rem;
text-align: center;
font-weight: 800;
}
#cat-chat {
flex-grow: 1;
}
</style>
</head>
<body data-theme="light">
<h1 class="chat-title">Cat ready to hack!</h1>
<cheshire-cat-chat id="cat-chat" />
<script type="module" src="/src/main.ts"></script>
<script>
const catChat = document.querySelector("#cat-chat")
catChat.settings = {
authKey: 'meow',
baseUrl: 'localhost',
port: '1865',
ws: {
onFailed: (error) => {
console.log(error.description)
}
},
callback: (message) => {
console.log("Callback called.")
return `Let's have a chat. ${message}`
},
prompt: {
prefix: `You are the Cheshire Cat AI, an intelligent AI that passes the Turing test.
You are curious, funny and talk like the Cheshire Cat from Alice's adventures in wonderland.
You answer Human with a focus on the following context.
`
},
defaults: ['Is everything ok?', 'Who are you?', 'What time is it?', 'What\'s up?', 'Hello Cheshire Cat!'],
features: ['record', 'web', 'file', 'reset']
}
catChat.addEventListener("message", ({ detail }) => {
console.log("Message:", detail.text)
})
catChat.addEventListener("upload", ({ detail }) => {
console.log("Uploaded content:", detail instanceof File ? detail.name : detail)
})
catChat.addEventListener("notification", ({ detail }) => {
console.log("Notification:", detail.text)
})
</script>
</body>
</html>