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

Change message order not possible #17

Closed
bazylhorsey opened this issue Feb 13, 2023 · 1 comment
Closed

Change message order not possible #17

bazylhorsey opened this issue Feb 13, 2023 · 1 comment

Comments

@bazylhorsey
Copy link

if st.session_state['generated']:
    for i in range(len(st.session_state['generated'])-1, -1, 1):
        message(st.session_state['past'][i], is_user=True, key=str(i) + '_user', avatar_style='personas')
        message(st.session_state['generated'][i], key=str(i), avatar_style='identicon')

Using a positive step in the messages should be possible. However, it stays one behind if using a positive step (1),
The library seems to only work if step on the for loop is set to -1.

@yashppawar
Copy link
Member

yashppawar commented Feb 22, 2023

Sorry I didn't get what you mean, if you mean the step value in the range(), then it has nothing to do with this library, streamlit-chat is just a UI component, you might want to look at how the data is stored in the session_state

feel free to reopen the issue if needed, and tag me so I will be notified

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