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

Group chatbot messages by default #10169

Merged
merged 39 commits into from
Dec 13, 2024
Merged

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Dec 10, 2024

Description

Closes: #8850

By default, consecutive messages are displayed in the same bubble. This is controlled by the new display_consecutive_in_same_bubble param of Chatbot.

consecutive_messages

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Testing and Formatting Your Code

  1. PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests: bash scripts/run_backend_tests.sh

  2. Please run these bash scripts to automatically format your code: bash scripts/format_backend.sh, and (if you made any changes to non-Python files) bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 10, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/c5e4d46c5c47779fdc6751496095a2ec5af83f45/gradio-5.8.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c5e4d46c5c47779fdc6751496095a2ec5af83f45#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/c5e4d46c5c47779fdc6751496095a2ec5af83f45/gradio-client-1.8.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/c5e4d46c5c47779fdc6751496095a2ec5af83f45/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 10, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/chatbot minor
gradio minor

With the following changelog entry.

By default, consecutive messages are displayed in the same bubble. This is controlled by the new display_consecutive_in_same_bubble param of Chatbot.

⚠️ The changeset file for this pull request has been modified manually, so the changeset generation bot has been disabled. To go back into automatic mode, delete the changeset file.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

This reverts commit f1ea8f8.
@freddyaboulton freddyaboulton marked this pull request as ready for review December 10, 2024 23:22
@@ -198,6 +198,7 @@ def __init__(
examples: list[ExampleMessage] | None = None,
show_copy_all_button=False,
allow_file_downloads=True,
display_consecutive_in_same_bubble: bool = True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the parameter name is kinda long. How about group_consecutive_messages?

@abidlabs abidlabs changed the title Group chatbot messages default Group chatbot messages by default Dec 11, 2024
@abidlabs
Copy link
Member

The only small thing I noticed was that when a file is not the first message in a group of messages, then the top right icons look "off" because they are rounded and lack a top border. E.g. look at the icons in the top right of the audio waveform here:

image

(Produced by running python demo/test_chatinterface_multimodal_examples/run.py and selecting the rightmost example.)

Otherwise, LGTM!

@abidlabs
Copy link
Member

Also I don't think the grouping applies if type="tuples"

@freddyaboulton
Copy link
Collaborator Author

Should be good for a re-review now - thanks @hannahblair for fixing the styling. We have omitted borders but fixed the rounding. We tried the borders but we think it looks better without.

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and looks great! Only nit is about shortening the parameter name but otherwise good to me

@freddyaboulton freddyaboulton enabled auto-merge (squash) December 13, 2024 20:07
@freddyaboulton freddyaboulton merged commit 25484f4 into main Dec 13, 2024
23 checks passed
@freddyaboulton freddyaboulton deleted the group-chatbot-messages-default branch December 13, 2024 20:11
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

Successfully merging this pull request may close these issues.

Be able to control grouping of chatbot messages
4 participants