Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,13 @@ if "messages" not in st.session_state:
|
|
25 |
|
26 |
# Hiển thị lịch sử chat
|
27 |
for message in st.session_state.messages:
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
st.markdown(message["content"])
|
30 |
|
31 |
# Ô nhập liệu chat
|
@@ -40,7 +46,7 @@ if user_input:
|
|
40 |
# Gọi chatbot để lấy phản hồi
|
41 |
response = get_chat_response(user_input)
|
42 |
|
43 |
-
# Hiển thị phản hồi của chatbot
|
44 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
45 |
-
with st.chat_message("assistant"):
|
46 |
st.markdown(response)
|
|
|
25 |
|
26 |
# Hiển thị lịch sử chat
|
27 |
for message in st.session_state.messages:
|
28 |
+
# Check role to optionally assign an avatar
|
29 |
+
if message["role"] == "assistant":
|
30 |
+
# Provide the URL of your chatbot avatar
|
31 |
+
avatar = "https://example.com/path/to/chatbot_avatar.png"
|
32 |
+
else:
|
33 |
+
avatar = None
|
34 |
+
with st.chat_message(message["role"], avatar=avatar):
|
35 |
st.markdown(message["content"])
|
36 |
|
37 |
# Ô nhập liệu chat
|
|
|
46 |
# Gọi chatbot để lấy phản hồi
|
47 |
response = get_chat_response(user_input)
|
48 |
|
49 |
+
# Hiển thị phản hồi của chatbot với avatar
|
50 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
51 |
+
with st.chat_message("assistant", avatar="avatar.png"):
|
52 |
st.markdown(response)
|