Summary
I have implemented thumbs-up/down buttons, in my chat bot, they are positioned well but I have a visual bug, once I am waiting for bot to respond the buttons change positions to be placed one below another for the time that boot is needed to respond, then they align properly again.
Code snippet:
if prompt := st.chat_input("State your question"):
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
result = full_result({"question": prompt, "chat_history": [
(message["role"], message["content"]) for message in st.session_state.messages]})
with st.chat_message("assistant"):
final_response = result["answer"]
st.markdown(final_response )
st.session_state.messages.append(
{"role": "assistant", "content": final_response})
col1,col2,col3,col4 = st.columns([3,3,0.5,0.5])
with col3:
if st.button(":thumbsup:"):
Print("Like")
with col4:
if st.button(":thumbsdown:"):
Print("Dislike")
Expected behavior:
The buttons should not be displayed in user bubble chat, only bot one, and they should not change their fixed places.
Actual behavior:
The buttons change positions and are shortly displayed in user chat while bot is loading response.