Add per-user styling to ChatFeed (ChatInterface) - #7939
Open
CTPassion wants to merge 7 commits into
Open
Conversation
CTPassion
marked this pull request as ready for review
May 22, 2025 15:56
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7939 +/- ##
==========================================
- Coverage 87.11% 86.66% -0.45%
==========================================
Files 346 346
Lines 53225 53261 +36
==========================================
- Hits 46367 46161 -206
- Misses 6858 7100 +242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
philippjfr
reviewed
Jun 2, 2025
| user_messages_stylesheets = param.Dict(default={}, doc=""" | ||
| A dictionary mapping user names to a list of CSS stylesheets to apply to messages by that user only. | ||
| E.g. {"User": [".message.user"], "Assistant": [".message {background: lightgrey;}"]} | ||
| """) |
Member
There was a problem hiding this comment.
I'd probably combine these under user_message_kwargs or similar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a common requirement to only apply certain styles to users within a chat feed. For me, this was obvious when I wanted to align user and agent messages to the left and right, for a classical conversation UI.
It has been mentioned here holoviz discourse and here #7488
Rather than just providing an alignment kwarg, I believe it more useful to expose the user to the full suite of styling options they may want to apply on a per-user basis. To align right for example, just apply:
To get it to look correct, I also had to apply some CSS to the .message class:
This way users can not just align messages but also change the colours, fonts, sizes etc. as before, but on a per-user basis rather than globally.