I’m developing a chat robot and I want to implement a feature that allow user evaluate every message from assistant, just like below
The solution seems add some widget just like button within chat_message.
But the problem is there is a refresh when new conversation occurred. Below is the code. (Sorry, i fail to find the way to insert code)
for message in st.session_state.messages:
i = 0
with st.chat_message(message[“role”]):
st.markdown(message[“content”])
if message[‘role’] == ‘assistant’:
st.button(‘Begin’, key=i, on_click=set_state, args=)
i += 1
There will be an error that duplicate widget id.
I want to ask two questions:
1, How to delete button with key?
2. Is there a recommend solution for this case?
Thanks.