Im trying to use form to collect feedback from the chat input, but it doesnt work.,
Here is a small snippet. Please help
with st.chat_message("user"):
st.markdown(prompt)
with st.chat_message("assistant"):
message_placeholder = st.empty()
full_response = ""
corrected_response = ""
for text in response.response_gen:
full_response += text + ""
time.sleep(0.05)
message_placeholder.markdown(full_response + "▌")
st.session_state.messages.append({"role": "assistant", "content": full_response})
with st.form("my_form"):
slider_val = st.radio(
"Score",
["1", "2", "3", "4", "5"])
feedback_text = st.text_input("Feedback")
# Every form must have a submit button.
submitted = st.form_submit_button("Submit")
print(submitted)
if submitted:
print(slider_val)
print(feedback_text)
st.write("Score:", slider_val)
st.write("Feedback:", feedback_text)