Spaces:
Sleeping
Sleeping
add avatar
Browse files
pages/2_Context-based_chatbot.py
CHANGED
|
@@ -195,7 +195,7 @@ if 'descriptions_context' not in st.session_state:
|
|
| 195 |
st.title("You name it! 🗣")
|
| 196 |
|
| 197 |
# JS: would remove Simon by some neutral avatar
|
| 198 |
-
with st.chat_message('user'):
|
| 199 |
st.write("Hey assistant!")
|
| 200 |
|
| 201 |
bot = st.chat_message('assistant')
|
|
@@ -204,7 +204,7 @@ bot.write("Hello human! Wanna practice naming some words?")
|
|
| 204 |
#for showing history of messages_context
|
| 205 |
for message in st.session_state.messages_context:
|
| 206 |
if message['role'] == 'user':
|
| 207 |
-
with st.chat_message(message['role']):
|
| 208 |
st.markdown(message['content'])
|
| 209 |
else:
|
| 210 |
with st.chat_message(message['role']):
|
|
@@ -214,7 +214,7 @@ for message in st.session_state.messages_context:
|
|
| 214 |
prompt_context = get_text()
|
| 215 |
if prompt_context:
|
| 216 |
#JS: would replace Simon by some neutral character
|
| 217 |
-
with st.chat_message('user'):
|
| 218 |
st.markdown(prompt_context)
|
| 219 |
#add to history
|
| 220 |
st.session_state.messages_context.append({'role': 'user', 'content': prompt_context})
|
|
|
|
| 195 |
st.title("You name it! 🗣")
|
| 196 |
|
| 197 |
# JS: would remove Simon by some neutral avatar
|
| 198 |
+
with st.chat_message('user', avatar='julian.jpg'):
|
| 199 |
st.write("Hey assistant!")
|
| 200 |
|
| 201 |
bot = st.chat_message('assistant')
|
|
|
|
| 204 |
#for showing history of messages_context
|
| 205 |
for message in st.session_state.messages_context:
|
| 206 |
if message['role'] == 'user':
|
| 207 |
+
with st.chat_message(message['role'], avatar='julian.jpg'):
|
| 208 |
st.markdown(message['content'])
|
| 209 |
else:
|
| 210 |
with st.chat_message(message['role']):
|
|
|
|
| 214 |
prompt_context = get_text()
|
| 215 |
if prompt_context:
|
| 216 |
#JS: would replace Simon by some neutral character
|
| 217 |
+
with st.chat_message('user', avatar="julian.jpg"):
|
| 218 |
st.markdown(prompt_context)
|
| 219 |
#add to history
|
| 220 |
st.session_state.messages_context.append({'role': 'user', 'content': prompt_context})
|