Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamlit_feedback disappears within expander #34

Closed
aymbot opened this issue Apr 3, 2024 · 3 comments
Closed

streamlit_feedback disappears within expander #34

aymbot opened this issue Apr 3, 2024 · 3 comments

Comments

@aymbot
Copy link

aymbot commented Apr 3, 2024

Streamlit version: 1.32.2

Issue: We have an issue where when we generate a query and the streamlit_feedback component is within a non-expanded expander, the thumbs/smileys are non existent in the UI. We have to reload with it expanded.

Sample code:

            st.write_stream(stream_data(query_result))
            with st.expander("Feedback"):
                feedback_result = streamlit_feedback(
                    feedback_type="thumbs",
                    optional_text_label="[Optional] Please provide an explanation",
                    align="flex-start",
                    on_submit=handle_feedback,
                    args=(query_text, query_result,),
                    key=f"feedback_{query_text}"
                )

                if feedback_result:
                    st.session_state.feedback.append(feedback_result)
@aymbot aymbot changed the title streamlit_feedback disappears within expander. streamlit_feedback disappears within expander Apr 3, 2024
@jeffkayne
Copy link
Contributor

The component works inside of an expander. Check out our example apps: https://github.com/trubrics/streamlit-feedback/blob/main/streamlit_feedback/examples.py

@aymbot
Copy link
Author

aymbot commented Apr 10, 2024

Hey @jeffkayne !

Thanks for the example apps, sadly none used expanders. I re-tested the above code. When I insert a feedback, close the expander, re-run a query, then re-open the expander, the feedback does indeed disappear (see below to what I mean with disappears).
So it works initially but after closing the expander and I generate a new query it disappears. Here is another test example, query is just a function that does an inference query.

        query_text = st.text_input("Enter your query here")
        if query_text:
            query_result = query(query_text)
            st.write_stream(
                stream_data(query_result)
            )
            with st.expander("Feedback Input"):
                feedback_result = streamlit_feedback(
                    feedback_type="thumbs",
                    optional_text_label="[Optional] Please provide an explanation",
                    align="flex-start",
                    on_submit=handle_feedback,
                    args=(query_text, query_result,),
                    key=f"feedback_{query_text}"
                )

            if feedback_result:
                st.session_state.feedback.append(feedback_result)

            with st.expander("Feedback"):
                st.session_state.feedback

image

@aymbot
Copy link
Author

aymbot commented Jun 3, 2024

Hey @jeffkayne ! I just wanted to ping this again, as this issue still persists. Thanks in advance for the heads up!

@aymbot aymbot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants