Change default avatars in st chat


Is there an option to use a different emoji for default st chat emojis?
(the ones on the left of the UI, not the avatars you can concatenate to a message)

You can pass an avatar argument

import streamlit as st

st.chat_message("user", avatar="πŸ˜‚").write("Hello")
st.chat_message("user", avatar="πŸ‘©β€πŸŽ€").write("Hi!")
st.chat_message("user", avatar="πŸ‘©β€πŸŽ¨").write("Hey!")

You can use the avatar parameter in st.chat_message to change the avatar of the chat

import streamlit as st

with st.chat_message('Momos', avatar="πŸ€–"):
    st.write('Hello there!')
with st.chat_message('Me', avatar="πŸ¦–"):


You can also add your own image by using st.image:

with st.chat_message('Momos', avatar=st.image('path_to_image'):
    st.write('Hello there!')

For changing avatars in chat input, simply use chat_message instead of st.write

prompt = st.chat_input('Enter your prompt!')
if prompt:
   with st.chat_message('Momos', avatar="πŸ€–"):
    st.write('Hello again... again!') 


1 Like