-
Notifications
You must be signed in to change notification settings - Fork 4k
Add max_upload_size parameter to file_uploader and chat_input #12816
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
Add max_upload_size parameter to file_uploader and chat_input #12816
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Just looked for this option and found this PR :) |
|
@rishabhjain1712 seems like this doesn't work when I try it out, see my comment above. |
|
@jrieke pushed the changes, request you to take a look |
|
Looks good from product side! I thought about the parameter name today, and I think we should actually switch to I think we'll definitely also want some tests for this, but will pass it to our engs for proper review. |
|
@jrieke changed the name to max_upload_size, this is ready to merge. |
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.
Pull Request Overview
This PR adds a max_upload_size parameter to st.file_uploader() to enable per-widget file size limits, addressing issue #12692. When not specified, the widget falls back to the global server.maxUploadSize configuration.
Key Changes
- Added
max_upload_sizeparameter to both the public and internalfile_uploadermethods - Implemented conditional logic to use the parameter value or fall back to the global config
- Parameter is passed through to the protobuf's
max_upload_size_mbfield
|
@jrieke should i resolve the conflicts by accepting both changes current and incoming changes? |
|
@rishabhjain1712 Pinged our eng team to give you some help :) I think we definitely also need some tests for this. |
sfc-gh-bnisco
left a comment
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.
Thanks for the contribution! I have some feedback inline, and some +1s to some feedback left by Copilot.
| self, | ||
| label: str, | ||
| type: str | Sequence[str] | None = None, | ||
| max_upload_size: int | None = None, |
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.
question: @jrieke should we consider also adding this param to st.audio_input, since that returns a file that is bounded by server.maxUploadSize
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.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
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.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
lukasmasuch
left a comment
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.
LGTM 👍
|
Wohoo, thanks for getting this in @rishabhjain1712! Would love to send you some swag as a little thank you, just fill out this form and we'll get it on the way: https://forms.gle/RZCUTKCrg7aHyqH78 |
Title
Add
max_upload_sizeparameter tost.file_uploaderto limit file size per widgetDescription
This PR implements the requested enhancement from issue [#12692](#12692):
max_upload_sizeparameter tost.file_uploader().max_upload_sizeis not provided, the widget falls back to the globalserver.maxUploadSizeconfiguration.max_upload_sizelimit are blocked before upload, improving UX and saving bandwidth.Closes #12692
Closes #12579