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
chatbot conversation nodes can contain a copy button #5125
chatbot conversation nodes can contain a copy button #5125
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Cool! |
This is really neat! |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
The demo notebooks don't match the run.py files. Please run this command from the root of the repo and then commit the changes: pip install nbformat && cd demo && python generate_notebooks.py |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-5125-all-demos You can install the changes in this PR by running: pip install https://gradio-builds.s3.amazonaws.com/4eda1657fff8a049dd38c73efd1223a844f455e0/gradio-3.39.0-py3-none-any.whl |
I tested the copy button and I think its fine to include. I still would disable it by default but providing developers with the option to include it if they want for their Chatbots seems like a good idea. @hannahblair and I added some comments above. One more thing -- clicking on the copy button does not provide any sort of visual feedback that the button has been clicked. @fazpu could you do something similar to what we do for the You can see that by running something like this: with gr.Blocks() as demo:
gr.JSON({"ab": "cd"})
demo.launch() Once the changes have been made, I'm fine with merging, wdyt @freddyaboulton @hannahblair? |
cursor: pointer; | ||
padding: 5px; | ||
top: 0; | ||
right: 0; |
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.
added the positioning to improve readability and avoid unexpected behaviour
@@ -46,30 +45,25 @@ | |||
</script> | |||
|
|||
<button on:click={handle_copy} title="copy"> | |||
<span class="copy-text" class:copied><Copy /> </span> |
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.
this logic seemed to be unmaintained - it was not working. I simplified and removed all the outdated and non-necessary parts.
@abidlabs Thank you for the feedback! The logic was already there in the Copy component. It just needed a small refresh. Please have a look. |
Tested, looks good. Thanks @fazpu for the great contribution 👍 Let's figure out the type error and then I believe we can merge in. |
Thanks @fazpu for this PR! Merging |
🎉 Chromatic build completed! There are 0 visual changes to review. |
no properties with gradio v 3.39.0, how to configure? GradioUnusedKwargWarning: You have unused kwarg parameters in Chatbot, please remove them: {'show_copy_button': True} |
@luoweb you have to upgrade to the latest version of pip install --upgrade gradio |
it's OK now, Thanks |
Hi there. I would like to make an additional suggestion regarding Chatbot Copy. Furthermore, I'm representing newlines as " Is there any way to address the issues mentioned above?" |
Description
The PR introduces a new parameter
show_chat_copy_button
to thegr.Chatbot
. WhenTrue
, it exposes theCopy
button for each converstation node.