-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhtml_templates.py
110 lines (97 loc) · 2.06 KB
/
html_templates.py
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
css = '''
<style>
/* Chat Container */
.chat-container {
width: 100%;
max-width: 800px;
margin: 0 auto;
}
/* Chat Message Styles */
.chat-message {
padding: 1rem;
border-radius: 0.5rem;
margin-bottom: 1rem;
display: flex;
align-items: center;
max-width: 70%;
}
.chat-message.user {
background-color: #2b313e;
color: #fff;
justify-content: flex-start;
}
.chat-message.bot {
background-color: #475063;
color: #fff;
justify-content: flex-end;
}
/* Avatar Styles */
.chat-message .avatar {
width: 15%;
margin-right: 1rem;
}
.chat-message .avatar img {
max-width: 100%;
max-height: 100%;
border-radius: 50%;
object-fit: cover;
}
/* Message Styles */
.chat-message .message {
flex-grow: 1;
padding: 0.5rem;
border-radius: 0.3rem;
}
/* User-specific Styling */
.chat-message.user .message {
background-color: #2b313e;
}
.chat-message.bot .message {
background-color: #475063;
}
/* Hover Effect */
.chat-message:hover {
transform: scale(1.02);
transition: transform 0.2s ease-in-out;
}
/* Typing Animation (Bot Only) */
.bot.typing .message::before {
content: '';
display: inline-block;
width: 8px;
height: 8px;
margin-right: 5px;
background-color: #fff;
border-radius: 50%;
animation: typing 1s infinite;
}
@keyframes typing {
0% {
opacity: 0;
transform: translateY(3px);
}
50% {
opacity: 1;
}
100% {
opacity: 0;
transform: translateY(-3px);
}
}
'''
bot_template = '''
<div class="chat-message bot">
<div class="avatar">
<img src="https://i.ibb.co/cN0nmSj/Screenshot-2023-05-28-at-02-37-21.png">
</div>
<div class="message">{{MSG}}</div>
</div>
'''
user_template = '''
<div class="chat-message user">
<div class="avatar">
<img src="">
</div>
<div class="message">{{MSG}}</div>
</div>
'''