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
Fix issues with local image as st.chat_message
avatar
#7130
Conversation
st.chat_message
avatar
@@ -194,7 +197,9 @@ def chat_message( | |||
): | |||
# For selected labels, we are mapping the label to an avatar | |||
avatar = name.lower() | |||
avatar_type, converted_avatar = _process_avatar_input(avatar) | |||
avatar_type, converted_avatar = _process_avatar_input( | |||
avatar, self.dg._get_delta_path_str() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LukasMasuch one question I have, since I am not super familiar with the chat_message
design.
Is self.dg._get_delta_path_str()
return unique "coordinates" for different chat_messages?
I looked into the media_file_manager
implementation and looks like this should not cause "multiple uploads of the same file" / "unwanted premature file removals for the file" issues.
Just to confirm that everything works correctly, could we add another playwright check where we check that the same image used multiple times as an avatar for different chat_message
doesn't cause any errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki 👍 I added one more e2e check that reuses the same local image. Does that cover it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that covers exactly that case :)
* Fix issues with local image as message avatar * Add chat message e2e playwright test * Fix unit test issue * Update chat message snapshots * Wait until images have loaded * Add second message reusing the same image * Increment counter * Add additional snapshot * Change timeout * Change how we wait for image to load * Add missing snapshot
* Fix issues with local image as message avatar * Add chat message e2e playwright test * Fix unit test issue * Update chat message snapshots * Wait until images have loaded * Add second message reusing the same image * Increment counter * Add additional snapshot * Change timeout * Change how we wait for image to load * Add missing snapshot
* Fix issues with local image as message avatar * Add chat message e2e playwright test * Fix unit test issue * Update chat message snapshots * Wait until images have loaded * Add second message reusing the same image * Increment counter * Add additional snapshot * Change timeout * Change how we wait for image to load * Add missing snapshot
Describe your changes
This PR fixes two issues with using local images as avatar for
st.chat_message
:st.image
).Testing Plan
Update the relevant tests. Added e2e test with local image and migrated test from cypres to playwright.
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.