-
Notifications
You must be signed in to change notification settings - Fork 0
/
htmlTemplates.py
113 lines (110 loc) · 2.62 KB
/
htmlTemplates.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
111
112
113
css = '''
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');
body {
background-color: #f0f2f6;
font-family: 'Roboto', sans-serif;
}
.chat-message {
padding: 1.5rem;
border-radius: 0.8rem;
margin-bottom: 1rem;
display: flex;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transition: all 0.3s ease-in-out;
opacity: 0;
transform: translateY(20px);
animation: fadeIn 0.5s ease-out forwards;
}
@keyframes fadeIn {
to {
opacity: 1;
transform: translateY(0);
}
}
.chat-message.user {
background-color: #2b313e;
}
.chat-message.bot {
background-color: #475063;
}
.chat-message .avatar {
width: 15%;
}
.chat-message .avatar img {
max-width: 60px;
max-height: 60px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #fff;
}
.chat-message .message {
width: 85%;
padding: 0 1.5rem;
color: #fff;
font-size: 1rem;
line-height: 1.5;
}
.stTextInput > div > div > input {
background-color: #f0f2f6;
color: #2b313e;
border-radius: 0.5rem;
border: 1px solid #ccc;
padding: 0.5rem 1rem;
font-size: 1rem;
transition: all 0.3s ease;
}
.stTextInput > div > div > input:focus {
border-color: #4CAF50;
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}
.stButton > button {
border-radius: 0.5rem;
font-weight: 500;
background-color: #4CAF50;
color: white;
border: none;
padding: 0.5rem 1rem;
font-size: 1rem;
transition: all 0.3s ease;
}
.stButton > button:hover {
background-color: #45a049;
}
.stTextArea > div > div > textarea {
background-color: #f0f2f6;
color: #2b313e;
border-radius: 0.5rem;
border: 1px solid #ccc;
padding: 0.5rem 1rem;
font-size: 1rem;
transition: all 0.3s ease;
}
.stTextArea > div > div > textarea:focus {
border-color: #4CAF50;
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}
</style>
'''
bot_template = '''
<div class="chat-message bot">
<div class="avatar">
<img src="https://cdn.pixabay.com/photo/2017/03/31/23/11/robot-2192617_1280.png">
</div>
<div class="message">{{MSG}}</div>
</div>
'''
user_template = '''
<div class="chat-message user">
<div class="avatar">
<img src="https://cdn.pixabay.com/photo/2017/11/10/05/48/user-2935527_1280.png">
</div>
<div class="message">{{MSG}}</div>
</div>
'''
loading_template = """
<div style="background-color:#e8f5e9; padding:10px; border-radius:10px; margin:5px 0;">
<strong>AI:</strong>
<p><img src="https://i.imgur.com/6RMhx.gif" width="20" style="vertical-align: middle;"> Đang xử lý...</p>
</div>
"""